From mboxrd@z Thu Jan 1 00:00:00 1970 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 9B028C433F5 for ; Fri, 4 Feb 2022 09:21:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1357456AbiBDJVQ (ORCPT ); Fri, 4 Feb 2022 04:21:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357355AbiBDJU7 (ORCPT ); Fri, 4 Feb 2022 04:20:59 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E936C061741; Fri, 4 Feb 2022 01:20:59 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id AC70D615DC; Fri, 4 Feb 2022 09:20:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 82921C004E1; Fri, 4 Feb 2022 09:20:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643966458; bh=pe+rjSYtf6W6CfYVu9AZX/jgeU3hf3dspXjjWJn5qaM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QWvcOwnZHW6Q7WPppg4+pmfsxlfsgNA7qoYx/+l9ZkWRztIuUlNGqsiW+jJ2Pjk8U /1LU89LniRwRYBK/vBQ1mKhE/tEadLwcDiHgaq+3RsObt5MNcte2U/ptp+Dg2ONORV h1H0r/h/HlZ8b9Ue9eQxB4OolXx7Zg3HMX2c4qiE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tianchen Ding , Waiman Long , Tejun Heo Subject: [PATCH 5.4 09/10] cpuset: Fix the bug that subpart_cpus updated wrongly in update_cpumask() Date: Fri, 4 Feb 2022 10:20:22 +0100 Message-Id: <20220204091912.624395230@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220204091912.329106021@linuxfoundation.org> References: <20220204091912.329106021@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tianchen Ding commit c80d401c52a2d1baf2a5afeb06f0ffe678e56d23 upstream. subparts_cpus should be limited as a subset of cpus_allowed, but it is updated wrongly by using cpumask_andnot(). Use cpumask_and() instead to fix it. Fixes: ee8dde0cd2ce ("cpuset: Add new v2 cpuset.sched.partition flag") Signed-off-by: Tianchen Ding Reviewed-by: Waiman Long Signed-off-by: Tejun Heo Signed-off-by: Greg Kroah-Hartman --- kernel/cgroup/cpuset.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/kernel/cgroup/cpuset.c +++ b/kernel/cgroup/cpuset.c @@ -1558,8 +1558,7 @@ static int update_cpumask(struct cpuset * Make sure that subparts_cpus is a subset of cpus_allowed. */ if (cs->nr_subparts_cpus) { - cpumask_andnot(cs->subparts_cpus, cs->subparts_cpus, - cs->cpus_allowed); + cpumask_and(cs->subparts_cpus, cs->subparts_cpus, cs->cpus_allowed); cs->nr_subparts_cpus = cpumask_weight(cs->subparts_cpus); } spin_unlock_irq(&callback_lock);