Message ID | 20230617083043.2065556-1-linmiaohe@huawei.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1854826vqr; Sat, 17 Jun 2023 01:36:28 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ57Z4NMZ3H7gFbio7wX7BrimplG0WcE5fSqga8x9lTyxTCFbGpLuOAJHDeXgIj+8EMdXy35 X-Received: by 2002:a92:6e0c:0:b0:341:ea6f:1bbe with SMTP id j12-20020a926e0c000000b00341ea6f1bbemr1505637ilc.4.1686990988106; Sat, 17 Jun 2023 01:36:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686990988; cv=none; d=google.com; s=arc-20160816; b=Iw3jP3DoARBJTVWxHfHn5xSDQTBwh8GTY8esfBXgJJTpkXunhy1MA1HDli7KfiE2Vu MblKx/kZFf+cudgsOiNO/+bm2f4zeIE1I47KMYAcXKbEvcCB7JKPTvC3CzlgMEiEw5/K ULkIUZmKN1Zl8Lqv5e/r2uIRsBrQMxkT3UMn81PMcHZFKJFoyfuc74XSXxhaJZjbHTjg 8RnH/bmFTLhdp8oSeM4GcZsgyGDCtLno/Eumrrq2nLohA2ZXW8eSOBpl0gozEu3zF3c7 GZLS2UbkZFkcX7aBflkIRSTB5I+QvH1RJJdWkwhIw6x4nFNWTdqXFTBLvOnmOfQuLaza y0Kw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=JGVT2whgEPansm/X+6phYYYexkfUcgwTyDWnrkL+doM=; b=tXS4BnQKL+tyVw9GFrh6mnLEf/++bjcOlYN2BAv1+Gs9SgMPqYxp+7YcBlFDExjYO4 HiNsHSjM95JSGcMLTxTWn8ySXvjdEA6NV4gOU94GhA5FQAR4vqNPPecnG2PAdyuVlNS5 P6xtr9+ERPyXgmPxsEoOs/cFOxF9VVg7LpAEloSryGmpkjbBunowJwJcPD+OnDTbYWBH 5bW4AOibME1pDW2k5pbFLS8ZZ4ww1ta+T3SuvUjgdXFBFwlEdFEz51qKHKRCKPnItvnK 0LPBxT/ENJbDgAETzuAc7IpmyIwuIrRa7WOI5DUIbSti95ZPTvHE9zCbNnR8zPO7HCy9 S0XQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x4-20020a63db44000000b0053f3b62c207si4154059pgi.767.2023.06.17.01.36.13; Sat, 17 Jun 2023 01:36:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345932AbjFQIbT (ORCPT <rfc822;maxin.john@gmail.com> + 99 others); Sat, 17 Jun 2023 04:31:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234669AbjFQIbQ (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sat, 17 Jun 2023 04:31:16 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9DE3A10CF; Sat, 17 Jun 2023 01:31:14 -0700 (PDT) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Qjq4F2MQpzqSNm; Sat, 17 Jun 2023 16:31:09 +0800 (CST) Received: from huawei.com (10.175.104.170) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Sat, 17 Jun 2023 16:31:11 +0800 From: Miaohe Lin <linmiaohe@huawei.com> To: <longman@redhat.com>, <tj@kernel.org>, <hannes@cmpxchg.org>, <lizefan.x@bytedance.com> CC: <cgroups@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <linmiaohe@huawei.com> Subject: [PATCH] cgroup/cpuset: remove unneeded nodes_or() in cpuset_change_task_nodemask() Date: Sat, 17 Jun 2023 16:30:43 +0800 Message-ID: <20230617083043.2065556-1-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.104.170] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768938262125744166?= X-GMAIL-MSGID: =?utf-8?q?1768938262125744166?= |
Series |
cgroup/cpuset: remove unneeded nodes_or() in cpuset_change_task_nodemask()
|
|
Commit Message
Miaohe Lin
June 17, 2023, 8:30 a.m. UTC
The tsk->mems_allowed is changed before calling mpol_rebind_task() and
being reassigned right after it. But tsk->mems_allowed is not needed
inside mpol_rebind_task(). So remove unneeded tsk->mems_allowed modify
via nodes_or() here.
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
---
kernel/cgroup/cpuset.c | 1 -
1 file changed, 1 deletion(-)
Comments
On 6/17/23 04:30, Miaohe Lin wrote: > The tsk->mems_allowed is changed before calling mpol_rebind_task() and > being reassigned right after it. But tsk->mems_allowed is not needed > inside mpol_rebind_task(). So remove unneeded tsk->mems_allowed modify > via nodes_or() here. > > Signed-off-by: Miaohe Lin <linmiaohe@huawei.com> > --- > kernel/cgroup/cpuset.c | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c > index 58e6f18f01c1..33a429c1179f 100644 > --- a/kernel/cgroup/cpuset.c > +++ b/kernel/cgroup/cpuset.c > @@ -1941,7 +1941,6 @@ static void cpuset_change_task_nodemask(struct task_struct *tsk, > local_irq_disable(); > write_seqcount_begin(&tsk->mems_allowed_seq); > > - nodes_or(tsk->mems_allowed, tsk->mems_allowed, *newmems); > mpol_rebind_task(tsk, newmems); > tsk->mems_allowed = *newmems; > That line was inserted by commit cc9a6c8776615 ("cpuset: mm: reduce large amounts of memory barrier related damage v3"). At first glance, it does looks like it is not necessary. However, I am not sure if a race is possible that will produce a false failure because of missing this line. My 2 cents. Cheers, Longman
On 2023/6/19 22:37, Waiman Long wrote: > On 6/17/23 04:30, Miaohe Lin wrote: >> The tsk->mems_allowed is changed before calling mpol_rebind_task() and >> being reassigned right after it. But tsk->mems_allowed is not needed >> inside mpol_rebind_task(). So remove unneeded tsk->mems_allowed modify >> via nodes_or() here. >> >> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com> >> --- >> kernel/cgroup/cpuset.c | 1 - >> 1 file changed, 1 deletion(-) >> >> diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c >> index 58e6f18f01c1..33a429c1179f 100644 >> --- a/kernel/cgroup/cpuset.c >> +++ b/kernel/cgroup/cpuset.c >> @@ -1941,7 +1941,6 @@ static void cpuset_change_task_nodemask(struct task_struct *tsk, >> local_irq_disable(); >> write_seqcount_begin(&tsk->mems_allowed_seq); >> - nodes_or(tsk->mems_allowed, tsk->mems_allowed, *newmems); >> mpol_rebind_task(tsk, newmems); >> tsk->mems_allowed = *newmems; >> > > That line was inserted by commit cc9a6c8776615 ("cpuset: mm: reduce large amounts of memory barrier related damage v3"). At first glance, it does looks like it is not necessary. However, I am not sure if a race is possible that will produce a false failure because of missing this line. > Thanks for your comment. IMHO, the code is protected with mems_allowed_seq seqlock. So it should be fine even if there's a race. I will take a closer look to make sure whether race exists. > My 2 cents. Thanks. > > Cheers, > Longman > > .
diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c index 58e6f18f01c1..33a429c1179f 100644 --- a/kernel/cgroup/cpuset.c +++ b/kernel/cgroup/cpuset.c @@ -1941,7 +1941,6 @@ static void cpuset_change_task_nodemask(struct task_struct *tsk, local_irq_disable(); write_seqcount_begin(&tsk->mems_allowed_seq); - nodes_or(tsk->mems_allowed, tsk->mems_allowed, *newmems); mpol_rebind_task(tsk, newmems); tsk->mems_allowed = *newmems;