From: Tejun Heo Subject: Re: [PATCH v2] cgroup/cpuset: Don't filter offline CPUs in cpuset_cpus_allowed() for top cpuset tasks Date: Mon, 6 Feb 2023 10:15:32 -1000 Message-ID: References: <20230206034853.330463-1-longman@redhat.com> Mime-Version: 1.0 Return-path: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:from:to:cc:subject:date:message-id :reply-to; bh=dJb35mhM2Hbo2R5tiLKHQvqDWiCTe8jrz1+VmmZokUg=; b=pBxCY01r9CDzvCb4m4soEW0AV3WnU9oLYZAyLjld3Nb+mxlySjB4wCvRVd9En70iko L/c/CzynnU7bG0S4aKqtD67H/E/jYTZxDQ5AFgyKeyeKJ+rmonw8UjOog8fEntBVAY0A LBQ5uYBcgGg995N5Pqmf08fP/3vPbIpGu96UwjTh8FgKOBInWv+p67r3FDZdKumz3pHZ pISkxr2SlRYJoylU6ag4JfjJoRRubNx4pDVSLHvNU4iXtM57kBmOjKD+Pt9xexDKVW4/ zlru3lnpWVsD/Lm+ZHInNDu6+mBvdn5vmhqNHC5UTlg+pvwysYStqLSytggrrYL7eQCC Z0dQ== Sender: Tejun Heo Content-Disposition: inline In-Reply-To: <20230206034853.330463-1-longman-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> List-ID: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Waiman Long Cc: Zefan Li , Johannes Weiner , Will Deacon , Peter Zijlstra , linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, kernel-team-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org On Sun, Feb 05, 2023 at 10:48:53PM -0500, Waiman Long wrote: > Since commit 8f9ea86fdf99 ("sched: Always preserve the user > requested cpumask"), relax_compatible_cpus_allowed_ptr() is calling > __sched_setaffinity() unconditionally. This helps to expose a bug in > the current cpuset hotplug code where the cpumasks of the tasks in > the top cpuset are not updated at all when some CPUs become online or > offline. It is likely caused by the fact that some of the tasks in the > top cpuset, like percpu kthreads, cannot have their cpu affinity changed. > > One way to reproduce this as suggested by Peter is: > - boot machine > - offline all CPUs except one > - taskset -p ffffffff $$ > - online all CPUs > > Fix this by allowing cpuset_cpus_allowed() to return a wider mask that > includes offline CPUs for those tasks that are in the top cpuset. For > tasks not in the top cpuset, the old rule applies and only online CPUs > will be returned in the mask since hotplug events will update their > cpumasks accordingly. > > Fixes: 8f9ea86fdf99 ("sched: Always preserve the user requested cpumask") > Reported-by: Will Deacon > Originally-from: Peter Zijlstra (Intel) > Tested-by: Will Deacon > Signed-off-by: Waiman Long Applied to cgroup/for-6.2-fixes. Thanks. -- tejun