From nobody Tue Feb 10 23:01:45 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9C025C6FD1D for ; Fri, 17 Mar 2023 15:16:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231770AbjCQPQp (ORCPT ); Fri, 17 Mar 2023 11:16:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44048 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231702AbjCQPQh (ORCPT ); Fri, 17 Mar 2023 11:16:37 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1992D31BDF for ; Fri, 17 Mar 2023 08:15:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1679066133; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yyPOMwQLISxSVk5Hax7mBc5lUymcLlOh64gwiaoZAvQ=; b=N/RkptS5aI2xMFm9zDcpLDq6Q1+TBXYIKFRNCAcjfERZltj156vNlXDdWjStoDyEv0xm0i 4UhKCbqYO2KmsI+MrQeWj+t3YIR2eKKDzHb4i9HiGn1nGOke4kzoSdKwnOpirtfmjv6pfp bhda/HJX2Gr/TCBLX//IJklwCUehJvY= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-512-dZAI30q9PRKOvWTgzcfh4g-1; Fri, 17 Mar 2023 11:15:30 -0400 X-MC-Unique: dZAI30q9PRKOvWTgzcfh4g-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0602810146E3; Fri, 17 Mar 2023 15:15:30 +0000 (UTC) Received: from llong.com (unknown [10.22.10.238]) by smtp.corp.redhat.com (Postfix) with ESMTP id 83C49492B00; Fri, 17 Mar 2023 15:15:29 +0000 (UTC) From: Waiman Long To: Tejun Heo , Zefan Li , Johannes Weiner , Shuah Khan Cc: cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Will Deacon , Peter Zijlstra , =?UTF-8?q?Michal=20Koutn=C3=BD?= , Juri Lelli , Waiman Long Subject: [PATCH v2 1/4] cgroup/cpuset: Fix partition root's cpuset.cpus update bug Date: Fri, 17 Mar 2023 11:15:05 -0400 Message-Id: <20230317151508.1225282-2-longman@redhat.com> In-Reply-To: <20230317151508.1225282-1-longman@redhat.com> References: <20230317151508.1225282-1-longman@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" It was found that commit 7a2127e66a00 ("cpuset: Call set_cpus_allowed_ptr() with appropriate mask for task") introduced a bug that corrupted "cpuset.cpus" of a partition root when it was updated. It is because the tmp->new_cpus field of the passed tmp parameter of update_parent_subparts_cpumask() should not be used at all as it contains important cpumask data that should not be overwritten. Fix it by using tmp->addmask instead. Also update update_cpumask() to make sure that trialcs->cpu_allowed will not be corrupted until it is no longer needed. Fixes: 7a2127e66a00 ("cpuset: Call set_cpus_allowed_ptr() with appropriate = mask for task") Signed-off-by: Waiman Long --- kernel/cgroup/cpuset.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c index 636f1c682ac0..f310915d1257 100644 --- a/kernel/cgroup/cpuset.c +++ b/kernel/cgroup/cpuset.c @@ -1513,7 +1513,7 @@ static int update_parent_subparts_cpumask(struct cpus= et *cs, int cmd, spin_unlock_irq(&callback_lock); =20 if (adding || deleting) - update_tasks_cpumask(parent, tmp->new_cpus); + update_tasks_cpumask(parent, tmp->addmask); =20 /* * Set or clear CS_SCHED_LOAD_BALANCE when partcmd_update, if necessary. @@ -1770,10 +1770,13 @@ static int update_cpumask(struct cpuset *cs, struct= cpuset *trialcs, /* * Use the cpumasks in trialcs for tmpmasks when they are pointers * to allocated cpumasks. + * + * Note that update_parent_subparts_cpumask() uses only addmask & + * delmask, but not new_cpus. */ tmp.addmask =3D trialcs->subparts_cpus; tmp.delmask =3D trialcs->effective_cpus; - tmp.new_cpus =3D trialcs->cpus_allowed; + tmp.new_cpus =3D NULL; #endif =20 retval =3D validate_change(cs, trialcs); @@ -1838,6 +1841,11 @@ static int update_cpumask(struct cpuset *cs, struct = cpuset *trialcs, } spin_unlock_irq(&callback_lock); =20 +#ifdef CONFIG_CPUMASK_OFFSTACK + /* Now trialcs->cpus_allowed is available */ + tmp.new_cpus =3D trialcs->cpus_allowed; +#endif + /* effective_cpus will be updated here */ update_cpumasks_hier(cs, &tmp, false); =20 --=20 2.31.1 From nobody Tue Feb 10 23:01:45 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EE55CC6FD1D for ; Fri, 17 Mar 2023 15:16:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231750AbjCQPQx (ORCPT ); Fri, 17 Mar 2023 11:16:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231389AbjCQPQm (ORCPT ); Fri, 17 Mar 2023 11:16:42 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE51F3B225 for ; Fri, 17 Mar 2023 08:15:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1679066134; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=amVdrpHTvDqA9NrS62Whbl25Xahg4lsNNZAsfD0/8D0=; b=ioUAV2tSqiYeh4qr1dxmZQ8lwrnp96Vw0tbBzUM2DxD3XEe3zRPS81r71g5bianHDKdQiB Ihxy3jszeuMYGr2vY6otjYaqAEyKDHbk6FC2EuRAblDbODC3mH89be3z2Px2pewPK6Tcd6 Kjz7BN7BOJ13qChFAoHGE0BXfzHlsq4= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-20-dusQyZqEPyawIzgUhzWxMA-1; Fri, 17 Mar 2023 11:15:31 -0400 X-MC-Unique: dusQyZqEPyawIzgUhzWxMA-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 864BC3801EC6; Fri, 17 Mar 2023 15:15:30 +0000 (UTC) Received: from llong.com (unknown [10.22.10.238]) by smtp.corp.redhat.com (Postfix) with ESMTP id 12253492B00; Fri, 17 Mar 2023 15:15:30 +0000 (UTC) From: Waiman Long To: Tejun Heo , Zefan Li , Johannes Weiner , Shuah Khan Cc: cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Will Deacon , Peter Zijlstra , =?UTF-8?q?Michal=20Koutn=C3=BD?= , Juri Lelli , Waiman Long Subject: [PATCH v2 2/4] cgroup/cpuset: Skip task update if hotplug doesn't affect current cpuset Date: Fri, 17 Mar 2023 11:15:06 -0400 Message-Id: <20230317151508.1225282-3-longman@redhat.com> In-Reply-To: <20230317151508.1225282-1-longman@redhat.com> References: <20230317151508.1225282-1-longman@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If a hotplug event doesn't affect the current cpuset, there is no point to call hotplug_update_tasks() or hotplug_update_tasks_legacy(). So just skip it. Signed-off-by: Waiman Long Reviewed-by: Michal Koutn=C3=BD --- kernel/cgroup/cpuset.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c index f310915d1257..5b8d763555b0 100644 --- a/kernel/cgroup/cpuset.c +++ b/kernel/cgroup/cpuset.c @@ -3516,6 +3516,8 @@ static void cpuset_hotplug_update_tasks(struct cpuset= *cs, struct tmpmasks *tmp) update_tasks: cpus_updated =3D !cpumask_equal(&new_cpus, cs->effective_cpus); mems_updated =3D !nodes_equal(new_mems, cs->effective_mems); + if (!cpus_updated && !mems_updated) + goto unlock; /* Hotplug doesn't affect this cpuset */ =20 if (mems_updated) check_insane_mems_config(&new_mems); @@ -3527,6 +3529,7 @@ static void cpuset_hotplug_update_tasks(struct cpuset= *cs, struct tmpmasks *tmp) hotplug_update_tasks_legacy(cs, &new_cpus, &new_mems, cpus_updated, mems_updated); =20 +unlock: percpu_up_write(&cpuset_rwsem); } =20 --=20 2.31.1 From nobody Tue Feb 10 23:01:45 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C7296C6FD1D for ; Fri, 17 Mar 2023 15:16:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231695AbjCQPQk (ORCPT ); Fri, 17 Mar 2023 11:16:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44168 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229863AbjCQPQe (ORCPT ); Fri, 17 Mar 2023 11:16:34 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AACD84E5F7 for ; Fri, 17 Mar 2023 08:15:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1679066135; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xGXOF5DEcP6pwvx1eYY/0gGWQNDYbTOSJx5veuAvjus=; b=c1RRVw1pITr3l1jTRSK/jsvuWpTOtgk78Ei7Ggt0lzo9rvbZ+bHGoU94KcG+l8hIjP1/9M VyHwL6idgAvk4rKkvq/ZZPmeEhOHe6VJYFPWc/rnvQG9tqJTfEv/0DtaRqW65MMWMEaB1n y7h+xx8UOmsY02tg8Fctl17S25apBM0= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-269-KPwhbz6AN9y_PYfmsIre9w-1; Fri, 17 Mar 2023 11:15:31 -0400 X-MC-Unique: KPwhbz6AN9y_PYfmsIre9w-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 12C7E3C10246; Fri, 17 Mar 2023 15:15:31 +0000 (UTC) Received: from llong.com (unknown [10.22.10.238]) by smtp.corp.redhat.com (Postfix) with ESMTP id 924D6492B00; Fri, 17 Mar 2023 15:15:30 +0000 (UTC) From: Waiman Long To: Tejun Heo , Zefan Li , Johannes Weiner , Shuah Khan Cc: cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Will Deacon , Peter Zijlstra , =?UTF-8?q?Michal=20Koutn=C3=BD?= , Juri Lelli , Waiman Long Subject: [PATCH v2 3/4] cgroup/cpuset: Include offline CPUs when tasks' cpumasks in top_cpuset are updated Date: Fri, 17 Mar 2023 11:15:07 -0400 Message-Id: <20230317151508.1225282-4-longman@redhat.com> In-Reply-To: <20230317151508.1225282-1-longman@redhat.com> References: <20230317151508.1225282-1-longman@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Similar to commit 3fb906e7fabb ("group/cpuset: Don't filter offline CPUs in cpuset_cpus_allowed() for top cpuset tasks"), the whole set of possible CPUs including offline ones should be used for setting cpumasks for tasks in the top cpuset when a cpuset partition is modified as the hotplug code won't update cpumasks for tasks in the top cpuset when CPUs become online or offline. Signed-off-by: Waiman Long --- kernel/cgroup/cpuset.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c index 5b8d763555b0..db8793a2082f 100644 --- a/kernel/cgroup/cpuset.c +++ b/kernel/cgroup/cpuset.c @@ -1209,7 +1209,9 @@ void rebuild_sched_domains(void) * * Iterate through each task of @cs updating its cpus_allowed to the * effective cpuset's. As this function is called with cpuset_rwsem held, - * cpuset membership stays stable. + * cpuset membership stays stable. For top_cpuset, task_cpu_possible_mask() + * is used instead of effective_cpus to make sure all offline CPUs are also + * included as hotplug code won't update cpumasks for tasks in top_cpuset. */ static void update_tasks_cpumask(struct cpuset *cs, struct cpumask *new_cp= us) { @@ -1219,15 +1221,18 @@ static void update_tasks_cpumask(struct cpuset *cs,= struct cpumask *new_cpus) =20 css_task_iter_start(&cs->css, 0, &it); while ((task =3D css_task_iter_next(&it))) { - /* - * Percpu kthreads in top_cpuset are ignored - */ - if (top_cs && (task->flags & PF_KTHREAD) && - kthread_is_per_cpu(task)) - continue; + const struct cpumask *possible_mask =3D task_cpu_possible_mask(task); =20 - cpumask_and(new_cpus, cs->effective_cpus, - task_cpu_possible_mask(task)); + if (top_cs) { + /* + * Percpu kthreads in top_cpuset are ignored + */ + if ((task->flags & PF_KTHREAD) && kthread_is_per_cpu(task)) + continue; + cpumask_andnot(new_cpus, possible_mask, cs->subparts_cpus); + } else { + cpumask_and(new_cpus, possible_mask, cs->effective_cpus); + } set_cpus_allowed_ptr(task, new_cpus); } css_task_iter_end(&it); --=20 2.31.1 From nobody Tue Feb 10 23:01:45 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3ED4DC74A5B for ; Fri, 17 Mar 2023 15:16:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231702AbjCQPQz (ORCPT ); Fri, 17 Mar 2023 11:16:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231751AbjCQPQm (ORCPT ); Fri, 17 Mar 2023 11:16:42 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 492843B3CF for ; Fri, 17 Mar 2023 08:15:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1679066135; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XQ/fbLiMTxYvcy4Xv+isuWXHLsrugKjziame8MLcKpQ=; b=EE30zdnXa4imFeCY54+AIDEPKPIha2s7E5PtIY15p+72PIByifqRo3MABdXSU24TnYaUQn TalxLnA3JDX/f0jtecWlpS4lyu2wDjuod1C/DsvuuDYH2wgTv1q2vH1ZQLhImxe6PFfHQa COR871feI6Bp+G77WCymWdt20CfL2UQ= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-345-60e1ciYHONuf3FhLRFxLKQ-1; Fri, 17 Mar 2023 11:15:32 -0400 X-MC-Unique: 60e1ciYHONuf3FhLRFxLKQ-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9816C29AA2DD; Fri, 17 Mar 2023 15:15:31 +0000 (UTC) Received: from llong.com (unknown [10.22.10.238]) by smtp.corp.redhat.com (Postfix) with ESMTP id 20780492B00; Fri, 17 Mar 2023 15:15:31 +0000 (UTC) From: Waiman Long To: Tejun Heo , Zefan Li , Johannes Weiner , Shuah Khan Cc: cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Will Deacon , Peter Zijlstra , =?UTF-8?q?Michal=20Koutn=C3=BD?= , Juri Lelli , Waiman Long Subject: [PATCH v2 4/4] cgroup/cpuset: Minor updates to test_cpuset_prs.sh Date: Fri, 17 Mar 2023 11:15:08 -0400 Message-Id: <20230317151508.1225282-5-longman@redhat.com> In-Reply-To: <20230317151508.1225282-1-longman@redhat.com> References: <20230317151508.1225282-1-longman@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" This patch makes the following minor updates to the cpuset partition testing script test_cpuset_prs.sh. - Remove online_cpus function call as it will be called anyway on exit in cleanup. - Make the enabling of sched/verbose debugfs flag conditional on the "-v" verbose option and set DELAY_FACTOR to 2 in this case as cpuset partition operations are likely to be slowed down by enabling that. Signed-off-by: Waiman Long --- .../selftests/cgroup/test_cpuset_prs.sh | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/tools/testing/selftests/cgroup/test_cpuset_prs.sh b/tools/test= ing/selftests/cgroup/test_cpuset_prs.sh index 75c100de90ff..2b5215cc599f 100755 --- a/tools/testing/selftests/cgroup/test_cpuset_prs.sh +++ b/tools/testing/selftests/cgroup/test_cpuset_prs.sh @@ -15,13 +15,6 @@ skip_test() { =20 [[ $(id -u) -eq 0 ]] || skip_test "Test must be run as root!" =20 -# Set sched verbose flag, if available -if [[ -d /sys/kernel/debug/sched ]] -then - # Used to restore the original setting during cleanup - SCHED_DEBUG=3D$(cat /sys/kernel/debug/sched/verbose) - echo Y > /sys/kernel/debug/sched/verbose -fi =20 # Get wait_inotify location WAIT_INOTIFY=3D$(cd $(dirname $0); pwd)/wait_inotify @@ -37,10 +30,14 @@ CPUS=3D$(lscpu | grep "^CPU(s):" | sed -e "s/.*:[[:spac= e:]]*//") PROG=3D$1 VERBOSE=3D DELAY_FACTOR=3D1 +SCHED_DEBUG=3D while [[ "$1" =3D -* ]] do case "$1" in -v) VERBOSE=3D1 + # Enable sched/verbose can slow thing down + [[ $DELAY_FACTOR -eq 1 ]] && + DELAY_FACTOR=3D2 break ;; -d) DELAY_FACTOR=3D$2 @@ -54,6 +51,14 @@ do shift done =20 +# Set sched verbose flag if available when "-v" option is specified +if [[ -n "$VERBOSE" && -d /sys/kernel/debug/sched ]] +then + # Used to restore the original setting during cleanup + SCHED_DEBUG=3D$(cat /sys/kernel/debug/sched/verbose) + echo Y > /sys/kernel/debug/sched/verbose +fi + cd $CGROUP2 echo +cpuset > cgroup.subtree_control [[ -d test ]] || mkdir test @@ -65,7 +70,8 @@ cleanup() rmdir A1/A2/A3 A1/A2 A1 B1 > /dev/null 2>&1 cd .. rmdir test > /dev/null 2>&1 - echo "$SCHED_DEBUG" > /sys/kernel/debug/sched/verbose + [[ -n "$SCHED_DEBUG" ]] && + echo "$SCHED_DEBUG" > /sys/kernel/debug/sched/verbose } =20 # Pause in ms @@ -571,7 +577,6 @@ run_state_test() echo "Test $TEST[$I] failed result check!" eval echo \"\${$TEST[$I]}\" dump_states - online_cpus exit 1 } =20 @@ -582,7 +587,6 @@ run_state_test() eval echo \"\${$TEST[$I]}\" echo dump_states - online_cpus exit 1 } } @@ -594,7 +598,6 @@ run_state_test() eval echo \"\${$TEST[$I]}\" echo dump_states - online_cpus exit 1 } } --=20 2.31.1