From: Daniel Wagner <wagi-kQCPcA+X3s7YtjvyW6yDsg@public.gmane.org>
To: Glauber Costa <glommer-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
Cc: Neil Horman <nhorman-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org>,
netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Daniel Wagner
<daniel.wagner-98C5kh4wR6ohFhg+JK9F0w@public.gmane.org>,
"David S. Miller" <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>,
Gao feng <gaofeng-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>,
Jamal Hadi Salim <jhs-jkUAjuhPggJWk0Htik3J/w@public.gmane.org>,
John Fastabend
<john.r.fastabend-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
Li Zefan <lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>,
Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Subject: Re: [PATCH v1 3/5] cgroup: Protect access to task_cls_classid() when built as module
Date: Thu, 23 Aug 2012 11:12:28 +0200 [thread overview]
Message-ID: <5035F3FC.202@monom.org> (raw)
In-Reply-To: <50335101.5030109-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
On 21.08.2012 11:12, Glauber Costa wrote:
> On 08/20/2012 09:03 PM, Neil Horman wrote:
>>>> 2) Keep a separate internal counter to track the number of cgroup instances
>>>>>> so that you only inc the static key on the first create and dec it on the last
>>>>>> delete.
>>>>
>>>> If I got you right, than this would not be different then direclty using
>>>> static_key_slow_[inc|dec].
>>>>
>> As long as a cgroup subsystems ->destroy method is only called when the
>> subsystem is being removed, then I think thats correct. I'm not 100% sure thats
>> the case though.
>>
> THAT is correct, but not the call itself. ->destroy() is called with the
> cgroup_lock held, and there is a lockdep dependency created by cpuset
> that prevents the cpu_hotplug lock, taken by static branch updates, to
> be taken inside cgroup_lock.
>
> So unless cpuset is fixed - which is a major work, we can't do
> static_branch updates while holding the cgroup_lock.
Thanks a lot for the info on this problem. I have spend the last days
trying to figure out how you have solved this in memcg. It looks like
complex and fragile. So I rather avoid enabling/disabling the static
branch in cgrp_create()/cgroup_destroy() and do it on module init/exit
as it is done currently with the id assigment.
Initially I wanted to optimize the task_cls_classid() path, so that only
when a cgroup really exists we spent time in there. Though as soon the
controller is registered to the cgroup core, the code path is enabled.
That means when cls is builtin it is used all the time (even though no
one is using it). In the module case, it is the same. task_cls_classid()
path is used right after module init.
So there is no need to move the enabling/disabling of the static branch
at this point to create/destroy.
next prev parent reply other threads:[~2012-08-23 9:12 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-17 14:58 [PATCH v1 0/5] cgroup: Assign subsystem IDs during compile time Daniel Wagner
[not found] ` <1345215494-9181-1-git-send-email-wagi-kQCPcA+X3s7YtjvyW6yDsg@public.gmane.org>
2012-08-17 14:58 ` [PATCH v1 1/5] cgroup: Use empty task_cls_classid() when !CONFIG_NET_CLS(_MODULE) Daniel Wagner
2012-08-17 14:58 ` [PATCH v1 2/5] cgroup: Move sock_update_classid() decleration to cls_cgroup.h Daniel Wagner
2012-08-17 14:58 ` [PATCH v1 3/5] cgroup: Protect access to task_cls_classid() when built as module Daniel Wagner
[not found] ` <1345215494-9181-4-git-send-email-wagi-kQCPcA+X3s7YtjvyW6yDsg@public.gmane.org>
2012-08-17 18:28 ` Neil Horman
2012-08-20 0:59 ` Li Zefan
[not found] ` <50318BF9.2080803-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2012-08-20 11:08 ` Neil Horman
[not found] ` <20120817182855.GA11607-B26myB8xz7F8NnZeBjwnZQMhkBWG/bsMQH7oEaQurus@public.gmane.org>
2012-08-20 11:29 ` Daniel Wagner
[not found] ` <20120820112938.GA22415-rjQKm2AMs/APuY3F5OKgMy7zKzJi9e1+kcYEyfhdaNw@public.gmane.org>
2012-08-20 11:33 ` Glauber Costa
2012-08-20 17:03 ` Neil Horman
[not found] ` <20120820170342.GC1734-B26myB8xz7F8NnZeBjwnZQMhkBWG/bsMQH7oEaQurus@public.gmane.org>
2012-08-21 9:12 ` Glauber Costa
[not found] ` <50335101.5030109-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
2012-08-23 9:12 ` Daniel Wagner [this message]
[not found] ` <5035F3FC.202-kQCPcA+X3s7YtjvyW6yDsg@public.gmane.org>
2012-08-23 9:12 ` Glauber Costa
2012-08-17 14:58 ` [PATCH v1 4/5] cgroup: Protect access to task_netprioidx() " Daniel Wagner
2012-08-17 14:58 ` [PATCH v1 5/5] cgroup: Assign subsystem IDs during compile time Daniel Wagner
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=5035F3FC.202@monom.org \
--to=wagi-kqcpca+x3s7ytjvyw6ydsg@public.gmane.org \
--cc=cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=daniel.wagner-98C5kh4wR6ohFhg+JK9F0w@public.gmane.org \
--cc=davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org \
--cc=gaofeng-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org \
--cc=glommer-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org \
--cc=jhs-jkUAjuhPggJWk0Htik3J/w@public.gmane.org \
--cc=john.r.fastabend-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org \
--cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=nhorman-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org \
--cc=tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.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;
as well as URLs for NNTP newsgroup(s).