public inbox for cgroups@vger.kernel.org
 help / color / mirror / Atom feed
* Access rules for current->memcg
@ 2015-07-16 13:34 Nikolay Borisov
       [not found] ` <55A7B2D0.1030506-/eCPMmvKun9pLGFMi4vTTA@public.gmane.org>
  0 siblings, 1 reply; 15+ messages in thread
From: Nikolay Borisov @ 2015-07-16 13:34 UTC (permalink / raw)
  Cc: cgroups-u79uwXL29TY76Z2rM5mHXA

Hello,

I'd like to ask what are the locking rules when using
mem_cgroup_from_task(current)? Currently I'm doing this under
rcu_read_lock which I believe is sufficient. However, I've seen patches
where reference is obtained via mem_cgroup_from_task and then
css_tryget_online is used on the resulting cgroup?

Looking at the context of css_tryget_online it seems it will only
succeed if the cgroup isn't being terminated (cgroup_destroy_locked
isn't being invoked). Judging from this then if a css_tryget_online
succeeds this means the caller can be sure they are working with a live
cgroup, however, what happens if the process of acuiqring a reference on
css is skipped AND the caller is under RCU read lock? They are
guaranteed to succeed, but after the rcu read lock is released the
cgroup might go away ?

Essentially my use case is to obtain a reference to a memcg for the
current process and query some counter values IOW - just reading from
the memcg. Do I need to acquire a CSS reference in this case?

Regards,
Nikolay

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2015-07-21 12:25 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-16 13:34 Access rules for current->memcg Nikolay Borisov
     [not found] ` <55A7B2D0.1030506-/eCPMmvKun9pLGFMi4vTTA@public.gmane.org>
2015-07-16 14:59   ` Michal Hocko
     [not found]     ` <20150716145902.GA10758-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
2015-07-16 15:11       ` Nikolay Borisov
     [not found]         ` <55A7C9B4.3010907-/eCPMmvKun9pLGFMi4vTTA@public.gmane.org>
2015-07-16 15:22           ` Michal Hocko
     [not found]             ` <20150716152239.GA22529-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
2015-07-16 21:21               ` Nikolay Borisov
     [not found]                 ` <CAJFSNy6sLX82+3ZW_COr__pDTd9aSGgL1bjryMKKcVPhEN0F9g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-07-17  7:13                   ` Michal Hocko
     [not found]                     ` <20150717071339.GA24787-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
2015-07-17  7:16                       ` Nikolay Borisov
     [not found]                         ` <55A8ABC9.7090701-/eCPMmvKun9pLGFMi4vTTA@public.gmane.org>
2015-07-20 11:17                           ` Michal Hocko
     [not found]                             ` <20150720111707.GE1211-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
2015-07-20 11:22                               ` Nikolay Borisov
     [not found]                                 ` <55ACD9F8.2040802-/eCPMmvKun9pLGFMi4vTTA@public.gmane.org>
2015-07-21  7:48                                   ` Michal Hocko
     [not found]                                     ` <20150721074834.GF11967-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
2015-07-21  9:08                                       ` Nikolay Borisov
     [not found]                                         ` <55AE0C18.5000304-/eCPMmvKun9pLGFMi4vTTA@public.gmane.org>
2015-07-21  9:24                                           ` Johannes Weiner
2015-07-21  9:48                                           ` Michal Hocko
     [not found]                                             ` <20150721094832.GI11967-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
2015-07-21 10:32                                               ` Nikolay Borisov
     [not found]                                                 ` <55AE1FB7.8050107-/eCPMmvKun9pLGFMi4vTTA@public.gmane.org>
2015-07-21 12:25                                                   ` Michal Hocko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox