mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 02:32:09 -04:00
cgroup: introduce coalesce css_get() and css_put()
Current css_get() and css_put() increment/decrement css->refcnt one by
one.
This patch add a new function __css_get(), which takes "count" as a arg
and increment the css->refcnt by "count". And this patch also add a new
arg("count") to __css_put() and change the function to decrement the
css->refcnt by "count".
These coalesce version of __css_get()/__css_put() will be used to improve
performance of memcg's moving charge feature later, where instead of
calling css_get()/css_put() repeatedly, these new functions will be used.
No change is needed for current users of css_get()/css_put().
Signed-off-by: Daisuke Nishimura <[email protected]>
Acked-by: Paul Menage <[email protected]>
Cc: Balbir Singh <[email protected]>
Acked-by: KAMEZAWA Hiroyuki <[email protected]>
Cc: Li Zefan <[email protected]>
Cc: Daisuke Nishimura <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
2468c7234b
commit
d7b9fff711
2 changed files with 12 additions and 5 deletions
|
|
@ -3746,12 +3746,13 @@ static void check_for_release(struct cgroup *cgrp)
|
|||
}
|
||||
}
|
||||
|
||||
void __css_put(struct cgroup_subsys_state *css)
|
||||
/* Caller must verify that the css is not for root cgroup */
|
||||
void __css_put(struct cgroup_subsys_state *css, int count)
|
||||
{
|
||||
struct cgroup *cgrp = css->cgroup;
|
||||
int val;
|
||||
rcu_read_lock();
|
||||
val = atomic_dec_return(&css->refcnt);
|
||||
val = atomic_sub_return(count, &css->refcnt);
|
||||
if (val == 1) {
|
||||
if (notify_on_release(cgrp)) {
|
||||
set_bit(CGRP_RELEASABLE, &cgrp->flags);
|
||||
|
|
|
|||
Loading…
Reference in a new issue