lkml.org 
[lkml]   [2008]   [Oct]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 6/6] memcg: lazy lru addition
On Wed, 1 Oct 2008 17:01:19 +0900, KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:
> Delaying add_to_lru() and do it in batched manner like page_vec.
> For doing that 2 flags PCG_USED and PCG_LRU.
>
> Because __set_page_cgroup_lru() itself doesn't take lock_page_cgroup(),
> we need a sanity check inside lru_lock().
>
> And this delaying make css_put()/get() complicated.
> To make it clear,
> * css_get() is called from mem_cgroup_add_list().
> * css_put() is called from mem_cgroup_remove_list().
> * css_get()->css_put() is called while try_charge()->commit/cancel sequence.
> is newly added.
>

I like this new policy, but

> @@ -710,17 +774,18 @@ static void __mem_cgroup_commit_charge(s

===
if (PageCgroupLRU(pc)) {
ClearPageCgroupLRU(pc);
__mem_cgroup_remove_list(mz, pc);
css_put(&pc->mem_cgroup->css);
}
spin_unlock_irqrestore(&mz->lru_lock, flags);
}
===

Is this css_put needed yet?

> /* Here, PCG_LRU bit is cleared */
> pc->mem_cgroup = mem;
> /*
> + * We have to set pc->mem_cgroup before set USED bit for avoiding
> + * race with (delayed) __set_page_cgroup_lru() in other cpu.
> + */
> + smp_wmb();
> + /*
> * below pcg_default_flags includes PCG_LOCK bit.
> */
> pc->flags = pcg_default_flags[ctype];
> unlock_page_cgroup(pc);
>
> - mz = page_cgroup_zoneinfo(pc);
> -
> - spin_lock_irqsave(&mz->lru_lock, flags);
> - __mem_cgroup_add_list(mz, pc, true);
> - SetPageCgroupLRU(pc);
> - spin_unlock_irqrestore(&mz->lru_lock, flags);
> + set_page_cgroup_lru(pc);
> + css_put(&mem->css);
> }
>
> /**


Thanks,
Daisuke Nishimura.


\
 
 \ /
  Last update: 2008-10-09 08:47    [W:0.169 / U:0.024 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site