[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8f4ed996-e6e5-75f4-b5fa-dffb7b7da05b@grsecurity.net>
Date: Fri, 5 Nov 2021 15:44:27 +0100
From: Mathias Krause <minipli@...ecurity.net>
To: Vincent Guittot <vincent.guittot@...aro.org>
Cc: Benjamin Segall <bsegall@...gle.com>,
Ingo Molnar <mingo@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Juri Lelli <juri.lelli@...hat.com>,
Michal Koutný <mkoutny@...e.com>,
Dietmar Eggemann <dietmar.eggemann@....com>,
Steven Rostedt <rostedt@...dmis.org>,
Mel Gorman <mgorman@...e.de>,
Daniel Bristot de Oliveira <bristot@...hat.com>,
Valentin Schneider <Valentin.Schneider@....com>,
linux-kernel@...r.kernel.org, Odin Ugedal <odin@...d.al>,
Kevin Tanguy <kevin.tanguy@...p.ovh.com>,
Brad Spengler <spender@...ecurity.net>
Subject: Re: [PATCH] sched/fair: Prevent dead task groups from regaining
cfs_rq's
Am 05.11.21 um 15:25 schrieb Vincent Guittot:
> On Thu, 4 Nov 2021 at 18:37, Mathias Krause <minipli@...ecurity.net> wrote:
>>
>> Am 04.11.21 um 17:49 schrieb Vincent Guittot:
>>> [snip]
>>>
>>> Ok so we must have 2 GPs:
>>>
>>> list_del_rcu(&tg->siblings);
>>> GP to wait for the end of ongoing walk_tg_tree_from : synchronize_rcu
>>> in your patch
>>> list_del_leaf_cfs_rq(tg->cfs_rq[cpu]); if on_list
>>> remove_entity_load_avg(tg->se[cpu]);
>>> GP to wait for the end of ongoing for_each_leaf_cfs_rq_safe (print_cfs_stats)
>>> kfree everything
>>
>> Basically yes, but with my patch we already have these two, as there's
>> at least one RCU GP between after sched_offline_group() finishes and
>> sched_free_group() / cpu_cgroup_css_free() starts.
>>
>> So we either use my patch as-is or move unregister_fair_sched_group() to
>> free_fair_sched_group() and use kfree_rcu() instead of kfree(). Both
>> approaches have pros and cons.
>>
>> Pro for my version is the early unlinking of cfs_rq's for dead task
>> groups, so no surprises later on. Con is the explicit synchronize_rcu().
>
> which blocks the caller and could be problematic
>
> It seems that LKP has reported such issue:
> 20211104145128.GC6499@...ng-OptiPlex-9020
Heh, indeed.
>>
>> Pro for the kfree_rcu() approach is the lack of the explicit
>> synchronize_rcu() call, so no explicit blocking operation. Con is that
>> we have cfs_rq's re-added to dead task groups which feels wrong and need
>> to find a suitable member to overlap with the rcu_head in each involved
>> data type.
>>
>> Which one do you prefer?
Looks like it needs to be the kfree_rcu() one in this case. I'll prepare
a patch.
Thanks,
Mathias
Powered by blists - more mailing lists