[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b50d7b64-121f-9a4c-5269-aec9a73787ba@codeaurora.org>
Date: Sat, 16 Dec 2017 00:36:33 +0530
From: Prateek Sood <prsood@...eaurora.org>
To: Tejun Heo <tj@...nel.org>
Cc: Peter Zijlstra <peterz@...radead.org>, avagin@...il.com,
mingo@...nel.org, linux-kernel@...r.kernel.org,
cgroups@...r.kernel.org, sramana@...eaurora.org
Subject: Re: [PATCH] cgroup/cpuset: fix circular locking dependency
On 12/15/2017 06:52 PM, Tejun Heo wrote:
> Hello, Prateek.
>
> On Fri, Dec 15, 2017 at 02:24:55PM +0530, Prateek Sood wrote:
>> Following are two ways to improve cgroup_transfer_tasks(). In
>> both cases task in PF_EXITING state would be left in source
>> cgroup. It would be removed from cgroup_exit() in exit path.
>>
>> diff --git a/kernel/cgroup/cgroup-v1.c b/kernel/cgroup/cgroup-v1.c
>> index 024085d..e2bdcdb 100644
>> --- a/kernel/cgroup/cgroup-v1.c
>> +++ b/kernel/cgroup/cgroup-v1.c
>> @@ -123,7 +123,10 @@ int cgroup_transfer_tasks(struct cgroup *to, struct cgroup *from)
>> */
>> do {
>> css_task_iter_start(&from->self, 0, &it);
>> - task = css_task_iter_next(&it);
>> + do {
>> + task = css_task_iter_next(&it);
>> + } while (task && (task & PF_EXITING))
>> +
>
> Yeah, this looks good to me. We can't just make a single pass as in
> the other one because we can race aginst fork. And PF_EXITING being
> left behind is what was happening previously too anyway. They can't
> be moved.
>
> Thanks.
>
Thanks TJ for reviewing.
I will send a formal patch with the above approved approach.
--
Qualcomm India Private Limited, on behalf of Qualcomm Innovation
Center, Inc., is a member of Code Aurora Forum, a Linux Foundation
Collaborative Project
Powered by blists - more mailing lists