Re: [PATCH] memcg: lock-free clear page writeback (Was Re: [PATCH04/10] memcg: disable local interrupts in lock_page_cgroup()

From: KAMEZAWA Hiroyuki
Date: Thu Oct 07 2010 - 05:10:59 EST


On Thu, 7 Oct 2010 15:24:22 +0900
KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx> wrote:

> Greg, I think clear_page_writeback() will not require _any_ locks with this patch.
> But set_page_writeback() requires it...
> (Maybe adding a special function for clear_page_writeback() is better rather than
> adding some complex to switch() in update_page_stat())
>

I'm testing a code like this.
==
/* pc->mem_cgroup is unstable ? */
if (unlikely(mem_cgroup_stealed(mem))) {
/* take a lock against to access pc->mem_cgroup */
if (!in_interrupt()) {
lock_page_cgroup(pc);
need_unlock = true;
mem = pc->mem_cgroup;
if (!mem || !PageCgroupUsed(pc))
goto out;
} else if (idx == MEMCG_NR_FILE_WRITEBACK && (val < 0)) {
/* This is allowed */
} else
BUG();
}
==
Thanks,
-Kame

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/