![]() | |||||||||||||
Messages in this thread
Patch in this message |
mem_cgroup_charge() common has to take lock but the place of lock can be calculated in early stage. This patch tries to prefetch lock line. (Have some good effect on my host.) Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> --- mm/memcontrol.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) Index: linux-2.6.27-rc1-mm1/mm/memcontrol.c =================================================================== --- linux-2.6.27-rc1-mm1.orig/mm/memcontrol.c +++ linux-2.6.27-rc1-mm1/mm/memcontrol.c @@ -707,11 +707,14 @@ static int mem_cgroup_charge_common(stru struct page_cgroup *pc; unsigned long nr_retries = MEM_CGROUP_RECLAIM_RETRIES; unsigned long flags; + int nid, zid; pc = kmem_cache_alloc(page_cgroup_cache, gfp_mask); if (unlikely(pc == NULL)) goto err; + nid = page_to_nid(page); + zid = page_zonenum(page); /* * We always charge the cgroup the mm_struct belongs to. * The mm_struct's mem_cgroup changes on task migration if the @@ -753,6 +756,8 @@ static int mem_cgroup_charge_common(stru goto out; } } + mz = mem_cgroup_zoneinfo(mem, nid, zid); + prefetchw(mz); pc->mem_cgroup = mem; pc->page = page; @@ -773,7 +778,6 @@ static int mem_cgroup_charge_common(stru VM_BUG_ON(page->page_cgroup); page_assign_page_cgroup(page, pc); - mz = page_cgroup_zoneinfo(pc); spin_lock_irqsave(&mz->lru_lock, flags); __mem_cgroup_add_list(mz, pc); spin_unlock_irqrestore(&mz->lru_lock, flags); | ||||||||||||
| Last update: 2008-08-19 10:41 [from the cache] ©2003-2008 | |||||||||||||