From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752699AbcEBC1L (ORCPT ); Sun, 1 May 2016 22:27:11 -0400 Received: from mail-ig0-f170.google.com ([209.85.213.170]:36003 "EHLO mail-ig0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752151AbcEBC1K (ORCPT ); Sun, 1 May 2016 22:27:10 -0400 From: Boqun Feng To: linux-kernel@vger.kernel.org Cc: "Paul E. McKenney" , Josh Triplett , Boqun Feng Subject: [RFC rcu/next] torture: Stop onoff task if there is only one cpu Date: Mon, 2 May 2016 10:30:00 +0800 Message-Id: <1462156200-4811-1-git-send-email-boqun.feng@gmail.com> X-Mailer: git-send-email 2.8.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If the whole system has only one cpu, that cpu won't be able to be offlined, so there is no need onoff task is stil running. Signed-off-by: Boqun Feng --- I hit something like the following while I was running rcutorture in a guest with only one vCPU: [ 31.197457] rcu-torture:torture_onoff task: offlining 0 [ 31.197508] rcu-torture:torture_onoff task: offline 0 failed: errno -16 I know this is an expected behavior, but think we could just stop the onoff task if there is only one cpu. kernel/torture.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/kernel/torture.c b/kernel/torture.c index fb39a06bbef5..a85b7d61d9dd 100644 --- a/kernel/torture.c +++ b/kernel/torture.c @@ -194,6 +194,12 @@ torture_onoff(void *arg) for_each_online_cpu(cpu) maxcpu = cpu; WARN_ON(maxcpu < 0); + + if (maxcpu == 0) { + VERBOSE_TOROUT_STRING("only one cpu is found, onoff is impossible"); + goto stop; + } + if (onoff_holdoff > 0) { VERBOSE_TOROUT_STRING("torture_onoff begin holdoff"); schedule_timeout_interruptible(onoff_holdoff); @@ -209,6 +215,8 @@ torture_onoff(void *arg) &sum_online, &min_online, &max_online); schedule_timeout_interruptible(onoff_interval); } + +stop: torture_kthread_stopping("torture_onoff"); return 0; } -- 2.8.0