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

KAMEZAWA Hiroyuki kamezawa.hiroyu at jp.fujitsu.com
Thu Oct 7 02:05:29 PDT 2010


On Thu, 7 Oct 2010 15:24:22 +0900
KAMEZAWA Hiroyuki <kamezawa.hiroyu at jp.fujitsu.com> 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



More information about the Containers mailing list