From nobody Mon Apr 6 23:07:16 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 B61F8C54EE9 for ; Thu, 1 Sep 2022 20:59:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235036AbiIAU7N (ORCPT ); Thu, 1 Sep 2022 16:59:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234986AbiIAU6b (ORCPT ); Thu, 1 Sep 2022 16:58:31 -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 8CEC89A687 for ; Thu, 1 Sep 2022 13:58:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1662065905; 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=Yjsoi9jMIhi4zCKfFUwtWjEtMVRAwWq9W9IHBrQtpuI=; b=V9bbCZdCiCBJsIb0j+33izgaWxdEt/mB6mjWAdwoQE5nBVjzsCYb2jJMjtJrLtOv0FhMyh TYWum5Fozy8xPXTMYpc8BLceSJyvfSVi2COsRSOBFCqWUQh9/MgqmXS31PqJzcK+vmz6Bt bUZ5eSwlxWtl2pVac14MVUUv27F2oOY= 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-573-5vV1koFcMN61CaO3MmG7UA-1; Thu, 01 Sep 2022 16:58:21 -0400 X-MC-Unique: 5vV1koFcMN61CaO3MmG7UA-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 983AD1C08961; Thu, 1 Sep 2022 20:58:20 +0000 (UTC) Received: from llong.com (unknown [10.22.17.199]) by smtp.corp.redhat.com (Postfix) with ESMTP id F1DB91415137; Thu, 1 Sep 2022 20:58:19 +0000 (UTC) From: Waiman Long To: Tejun Heo , Zefan Li , Johannes Weiner , Jonathan Corbet , Shuah Khan Cc: cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org, Andrew Morton , Roman Gushchin , Phil Auld , Peter Zijlstra , Juri Lelli , Frederic Weisbecker , Marcelo Tosatti , =?UTF-8?q?Michal=20Koutn=C3=BD?= , Waiman Long Subject: [PATCH v12 07/10] cgroup/cpuset: Relocate a code block in validate_change() Date: Thu, 1 Sep 2022 16:57:42 -0400 Message-Id: <20220901205745.323326-8-longman@redhat.com> In-Reply-To: <20220901205745.323326-1-longman@redhat.com> References: <20220901205745.323326-1-longman@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.85 on 10.11.54.7 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" This patch moves down the exclusive cpu and memory check in validate_change(). There is no functional change. Signed-off-by: Waiman Long --- kernel/cgroup/cpuset.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c index 15fcd2f86108..b0d921d03f62 100644 --- a/kernel/cgroup/cpuset.c +++ b/kernel/cgroup/cpuset.c @@ -741,22 +741,6 @@ static int validate_change(struct cpuset *cur, struct = cpuset *trial) =20 par =3D parent_cs(cur); =20 - /* - * If either I or some sibling (!=3D me) is exclusive, we can't - * overlap - */ - ret =3D -EINVAL; - cpuset_for_each_child(c, css, par) { - if ((is_cpu_exclusive(trial) || is_cpu_exclusive(c)) && - c !=3D cur && - cpumask_intersects(trial->cpus_allowed, c->cpus_allowed)) - goto out; - if ((is_mem_exclusive(trial) || is_mem_exclusive(c)) && - c !=3D cur && - nodes_intersects(trial->mems_allowed, c->mems_allowed)) - goto out; - } - /* * Cpusets with tasks - existing or newly being attached - can't * be changed to have empty cpus_allowed or mems_allowed. @@ -781,6 +765,22 @@ static int validate_change(struct cpuset *cur, struct = cpuset *trial) trial->cpus_allowed)) goto out; =20 + /* + * If either I or some sibling (!=3D me) is exclusive, we can't + * overlap + */ + ret =3D -EINVAL; + cpuset_for_each_child(c, css, par) { + if ((is_cpu_exclusive(trial) || is_cpu_exclusive(c)) && + c !=3D cur && + cpumask_intersects(trial->cpus_allowed, c->cpus_allowed)) + goto out; + if ((is_mem_exclusive(trial) || is_mem_exclusive(c)) && + c !=3D cur && + nodes_intersects(trial->mems_allowed, c->mems_allowed)) + goto out; + } + ret =3D 0; out: rcu_read_unlock(); --=20 2.31.1