[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1222093420.16700.2.camel@lappy.programming.kicks-ass.net>
Date: Mon, 22 Sep 2008 16:23:40 +0200
From: Peter Zijlstra <a.p.zijlstra@...llo.nl>
To: KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>
Cc: "linux-mm@...ck.org" <linux-mm@...ck.org>,
"balbir@...ux.vnet.ibm.com" <balbir@...ux.vnet.ibm.com>,
"nishimura@....nes.nec.co.jp" <nishimura@....nes.nec.co.jp>,
"xemul@...nvz.org" <xemul@...nvz.org>,
LKML <linux-kernel@...r.kernel.org>, Ingo Molnar <mingo@...e.hu>
Subject: Re: [PATCH 4/13] memcg: force_empty moving account
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@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists