[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <5052F4FF.6070508@huawei.com>
Date: Fri, 14 Sep 2012 17:12:31 +0800
From: Li Zefan <lizefan@...wei.com>
To: Glauber Costa <glommer@...allels.com>
CC: Tejun Heo <tj@...nel.org>, <containers@...ts.linux-foundation.org>,
<cgroups@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
Michal Hocko <mhocko@...e.cz>,
Peter Zijlstra <peterz@...radead.org>,
Paul Turner <pjt@...gle.com>,
Johannes Weiner <hannes@...xchg.org>,
Thomas Graf <tgraf@...g.ch>,
"Serge E. Hallyn" <serue@...ibm.com>,
Paul Mackerras <paulus@...ba.org>,
Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...stprotocols.net>,
Neil Horman <nhorman@...driver.com>,
"Aneesh Kumar K.V" <aneesh.kumar@...ux.vnet.ibm.com>,
"Daniel P. Berrange" <berrange@...hat.com>,
Lennart Poettering <lennart@...ttering.net>,
Kay Sievers <kay.sievers@...y.org>
Subject: Re: [RFC] cgroup TODOs
>>
>> 2. memcg's __DEPRECATED_clear_css_refs
>>
>> This is a remnant of another weird design decision of requiring
>> synchronous draining of refcnts on cgroup removal and allowing
>> subsystems to veto cgroup removal - what's the userspace supposed to
>> do afterwards? Note that this also hinders co-mounting different
>> controllers.
>>
>> The behavior could be useful for development and debugging but it
>> unnecessarily interlocks userland visible behavior with in-kernel
>> implementation details. To me, it seems outright wrong (either
>> implement proper severing semantics in the controller or do full
>> refcnting) and disallows, for example, lazy drain of caching refs.
>> Also, it complicates the removal path with try / commit / revert
>> logic which has never been fully correct since the beginning.
>>
>> Currently, the only left user is memcg.
>>
>> Solution:
>>
>> * Update memcg->pre_destroy() such that it never fails.
>>
>> * Drop __DEPRECATED_clear_css_refs and all related logic.
>> Convert pre_destroy() to return void.
>>
>> Who:
>>
>> KAMEZAWA, Michal, PLEASE. I will make __DEPRECATED_clear_css_refs
>> trigger WARN sooner or later. Let's please get this settled.
>>
>> 3. cgroup_mutex usage outside cgroup core
>>
>> This is another thing which is simply broken. Given the way cgroup
>> is structured and used, nesting cgroup_mutex inside any other
>> commonly used lock simply doesn't work - it's held while invoking
>> controller callbacks which then interact and synchronize with
>> various core subsystems.
>>
>> There are currently three external cgroup_mutex users - cpuset,
>> memcontrol and cgroup_freezer.
>>
>> Solution:
>>
>> Well, we should just stop doing it - use a separate nested lock
>> (which seems possible for cgroup_freezer) or track and mange task
>> in/egress some other way.
>>
>> Who:
>>
>> I'll do the cgroup_freezer. I'm hoping PeterZ or someone who's
>> familiar with the code base takes care of cpuset. Michal, can you
>> please take care of memcg?
>>
>
> I think this is a pressing problem, yes, but not the only problem with
> cgroup lock. Even if we restrict its usage to cgroup core, we still can
> call cgroup functions, which will lock. And then we gain nothing.
>
Agreed. The biggest issue in cpuset is if hotplug makes a cpuset's cpulist
empty the tasks in it will be moved to an ancestor cgroup, which requires
holding cgroup lock. We have to either change cpuset's behavior or eliminate
the global lock.
> And the problem is that people need to lock. cgroup_lock is needed
> because the data you are accessing is protected by it. The way I see it,
> it is incredible how we were able to revive the BKL in the form of
> cgroup_lock after we finally manage to successfully get rid of it!
>
> We should just start to do a more fine grained locking of data, instead
> of "stop the world, cgroup just started!". If we do that, the problem
> you are trying to address here will even cease to exist.
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists