mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
mm: memcontrol: take a css reference for each charged page
Charges currently pin the css indirectly by playing tricks during css_offline(): user pages stall the offlining process until all of them have been reparented, whereas kmemcg acquires a keep-alive reference if outstanding kernel pages are detected at that point. In preparation for removing all this complexity, make the pinning explicit and acquire a css references for every charged page. Signed-off-by: Johannes Weiner <hannes@cmpxchg.org> Reviewed-by: Vladimir Davydov <vdavydov@parallels.com> Acked-by: Michal Hocko <mhocko@suse.cz> Cc: David Rientjes <rientjes@google.com> Cc: Tejun Heo <tj@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
5ac8fb31ad
commit
e8ea14cc6e
3 changed files with 92 additions and 24 deletions
|
@ -112,6 +112,19 @@ static inline void css_get(struct cgroup_subsys_state *css)
|
|||
percpu_ref_get(&css->refcnt);
|
||||
}
|
||||
|
||||
/**
|
||||
* css_get_many - obtain references on the specified css
|
||||
* @css: target css
|
||||
* @n: number of references to get
|
||||
*
|
||||
* The caller must already have a reference.
|
||||
*/
|
||||
static inline void css_get_many(struct cgroup_subsys_state *css, unsigned int n)
|
||||
{
|
||||
if (!(css->flags & CSS_NO_REF))
|
||||
percpu_ref_get_many(&css->refcnt, n);
|
||||
}
|
||||
|
||||
/**
|
||||
* css_tryget - try to obtain a reference on the specified css
|
||||
* @css: target css
|
||||
|
@ -159,6 +172,19 @@ static inline void css_put(struct cgroup_subsys_state *css)
|
|||
percpu_ref_put(&css->refcnt);
|
||||
}
|
||||
|
||||
/**
|
||||
* css_put_many - put css references
|
||||
* @css: target css
|
||||
* @n: number of references to put
|
||||
*
|
||||
* Put references obtained via css_get() and css_tryget_online().
|
||||
*/
|
||||
static inline void css_put_many(struct cgroup_subsys_state *css, unsigned int n)
|
||||
{
|
||||
if (!(css->flags & CSS_NO_REF))
|
||||
percpu_ref_put_many(&css->refcnt, n);
|
||||
}
|
||||
|
||||
/* bits in struct cgroup flags field */
|
||||
enum {
|
||||
/* Control Group requires release notifications to userspace */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue