linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vincent Guittot <vincent.guittot@linaro.org>
To: Mathias Krause <minipli@grsecurity.net>
Cc: "Benjamin Segall" <bsegall@google.com>,
	"Ingo Molnar" <mingo@redhat.com>,
	"Peter Zijlstra" <peterz@infradead.org>,
	"Juri Lelli" <juri.lelli@redhat.com>,
	"Michal Koutný" <mkoutny@suse.com>,
	"Dietmar Eggemann" <dietmar.eggemann@arm.com>,
	"Steven Rostedt" <rostedt@goodmis.org>,
	"Mel Gorman" <mgorman@suse.de>,
	"Daniel Bristot de Oliveira" <bristot@redhat.com>,
	"Valentin Schneider" <Valentin.Schneider@arm.com>,
	linux-kernel@vger.kernel.org, "Odin Ugedal" <odin@uged.al>,
	"Kevin Tanguy" <kevin.tanguy@corp.ovh.com>,
	"Brad Spengler" <spender@grsecurity.net>
Subject: Re: [PATCH] sched/fair: Prevent dead task groups from regaining cfs_rq's
Date: Fri, 5 Nov 2021 15:25:46 +0100	[thread overview]
Message-ID: <CAKfTPtDthksitm02sLowDMKbWZ29efth-YcPi0zVSFqbaZfiMA@mail.gmail.com> (raw)
In-Reply-To: <cd3778d3-6980-a804-47e3-82b09dc960a4@grsecurity.net>

On Thu, 4 Nov 2021 at 18:37, Mathias Krause <minipli@grsecurity.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@xsang-OptiPlex-9020

>
> 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?
>
> Thanks,
> Mathias

  reply	other threads:[~2021-11-05 14:26 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-11 17:22 [PATCH] sched/fair: Use rq->lock when checking cfs_rq list presence Michal Koutný
2021-10-11 19:12 ` Odin Ugedal
2021-10-12 18:32   ` Tao Zhou
2021-10-13 18:52     ` Odin Ugedal
2021-10-13 14:39   ` Michal Koutný
2021-10-13 18:45     ` Odin Ugedal
2021-10-13  7:57 ` Vincent Guittot
2021-10-13 14:26   ` Michal Koutný
2021-11-02 16:02     ` task_group unthrottling and removal race (was Re: [PATCH] sched/fair: Use rq->lock when checking cfs_rq list) presence Michal Koutný
2021-11-02 20:20       ` Odin Ugedal
2021-11-03  9:51       ` Mathias Krause
2021-11-03 10:51         ` Mathias Krause
2021-11-03 11:10           ` Michal Koutný
2021-11-03 14:16             ` Mathias Krause
2021-11-03 19:06               ` [PATCH] sched/fair: Prevent dead task groups from regaining cfs_rq's Mathias Krause
2021-11-03 22:03                 ` Benjamin Segall
2021-11-04  8:50                   ` Vincent Guittot
2021-11-04 15:13                     ` Mathias Krause
2021-11-04 16:49                       ` Vincent Guittot
2021-11-04 17:37                         ` Mathias Krause
2021-11-05 14:25                           ` Vincent Guittot [this message]
2021-11-05 14:44                             ` Mathias Krause
2021-11-05 16:29                               ` Mathias Krause
2021-11-05 16:58                                 ` Peter Zijlstra
2021-11-05 17:14                                   ` Mathias Krause
2021-11-05 17:27                                     ` Peter Zijlstra
2021-11-05 17:40                                       ` Mathias Krause
2021-11-06 10:48                                 ` Peter Zijlstra
2021-11-08 10:27                                   ` Mathias Krause
2021-11-08 11:40                                     ` Peter Zijlstra
2021-11-08 15:06                                       ` Mathias Krause
2021-11-10 15:14                                         ` Vincent Guittot
2021-11-09 18:47                                       ` Michal Koutný
2021-11-10 15:17                                         ` Vincent Guittot
2021-11-04 20:46                       ` Benjamin Segall
2021-11-04 18:49                 ` Michal Koutný
2021-11-05 14:55                   ` Mathias Krause
2021-11-05 14:58                 ` Peter Zijlstra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAKfTPtDthksitm02sLowDMKbWZ29efth-YcPi0zVSFqbaZfiMA@mail.gmail.com \
    --to=vincent.guittot@linaro.org \
    --cc=Valentin.Schneider@arm.com \
    --cc=bristot@redhat.com \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=juri.lelli@redhat.com \
    --cc=kevin.tanguy@corp.ovh.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=minipli@grsecurity.net \
    --cc=mkoutny@suse.com \
    --cc=odin@uged.al \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=spender@grsecurity.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).