Re: [PATCH 4/13] memcg: force_empty moving account
From: Peter Zijlstra
Date: Mon Sep 22 2008 - 10:24:28 EST
On Mon, 2008-09-22 at 20:00 +0900, KAMEZAWA Hiroyuki wrote:
> + /* For avoiding race with speculative page cache handling. */
> + if (!PageLRU(page) || !get_page_unless_zero(page)) {
> + list_move(&pc->lru, list);
> + spin_unlock_irqrestore(&mz->lru_lock, flags);
> + yield();
Gah, no way!
> + spin_lock_irqsave(&mz->lru_lock, flags);
> + continue;
> + }
> + if (!trylock_page(page)) {
> + list_move(&pc->lru, list);
> put_page(page);
> - if (--count <= 0) {
> - count = FORCE_UNCHARGE_BATCH;
> - cond_resched();
> - }
> - } else
> - cond_resched();
> - spin_lock_irqsave(&mz->lru_lock, flags);
> + spin_unlock_irqrestore(&mz->lru_lock, flags);
> + yield();
Seriously?!
> + spin_lock_irqsave(&mz->lru_lock, flags);
> + continue;
> + }
> + if (mem_cgroup_move_account(page, pc, mem, &init_mem_cgroup)) {
> + /* some confliction */
> + list_move(&pc->lru, list);
> + unlock_page(page);
> + put_page(page);
> + spin_unlock_irqrestore(&mz->lru_lock, flags);
> + yield();
Inflicting pain..
> + spin_lock_irqsave(&mz->lru_lock, flags);
> + } else {
> + unlock_page(page);
> + put_page(page);
> + }
> + if (atomic_read(&mem->css.cgroup->count) > 0)
> + break;
> }
> spin_unlock_irqrestore(&mz->lru_lock, flags);
do _NOT_ use yield() ever! unless you know what you're doing, and
probably not even then.
NAK!
--
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/