mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Li Zefan <lizefan@huawei.com>
To: Tejun Heo <tj@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Cgroups <cgroups@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH 1/6] cgroup: initialize cgrp->dentry before css_alloc()
Date: Wed, 23 Jan 2013 10:34:53 +0800	[thread overview]
Message-ID: <50FF4C4D.4020405@huawei.com> (raw)
In-Reply-To: <20130123002754.GB5359@htj.dyndns.org>

On 2013/1/23 8:27, Tejun Heo wrote:
> (cc'ing Andrew as scheduler folks are difficult to get response from
>  these days and I can't think of anyone else to bother :)
> 
> Hello, Li.
> 
> The cgroup part looks good to me but it would be great if the
> descriptions are more detailed, especially, about why the change is
> beneficial or what it's aiming at.  I take it that the shed changes
> are necessary to facilitate the later cgroup changes?  Can you please
> elaborate how?
> 

Scheduler changes made in patch #2 are preparation for #3 and #4.

- for #3:

After ss->css_alloc(), there's a small window that tg->css.cgroup is NULL.
With the change, tg won't be seen before ss->css_online(), so the scheduler
won't see NULL tg->css.cgroup.

- for #4:

If tg is unregistered and removed from global list in css_free(), and if
we kfree cgroup right after ss->css_free(), the scheduler can access
invalid tg->css.cgroup, because tg is also protected by RCU.

Without patch #2:

cgroup_rmdir()
  no ss->css_offline()
diput()
  syncronize_rcu()
  ss->css_free()    <-- remove tg from global list,
			and free tg via call_rcu()
  kfree_rcu(cgroup) <-- wait rcu read section

With the change:

cgroup_rmdir()
  ss->css_offline() <-- remove tg from global list
diput()
  synchronize_rcu() <-- wait rcu read section
  ss->css_free();   <-- free tg
  kfree(cgroup);

> The scheduler part of changes are mostly mechanical, so it would be
> great if we can get ack from scheduler people and route these together.
> 
> Thanks.
> 


  parent reply	other threads:[~2013-01-23  2:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-17  8:03 Li Zefan
2013-01-17  8:03 ` [PATCH 2/6] sched: split out tg creation/destruction to css_online/css_offline Li Zefan
2013-01-17  8:03 ` [PATCH 3/6] sched: remove redundant NULL cgroup check in task_group_path() Li Zefan
2013-01-17  8:04 ` [PATCH 4/6] cgroup: remove duplicate RCU free on struct cgroup Li Zefan
2013-01-17  8:04 ` [PATCH 5/6] cgroup: remove synchronize_rcu() from cgroup_diput() Li Zefan
2013-01-17  8:05 ` [PATCH 6/6] cgroup: remove bogus comments in cgroup_diput() Li Zefan
2013-01-23  0:27 ` [PATCH 1/6] cgroup: initialize cgrp->dentry before css_alloc() Tejun Heo
2013-01-23  0:35   ` Andrew Morton
2013-01-23  2:34   ` Li Zefan [this message]
2013-01-23 16:35     ` Tejun Heo

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=50FF4C4D.4020405@huawei.com \
    --to=lizefan@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=cgroups@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=tj@kernel.org \
    /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

Powered by JetHome