lkml.org 
[lkml]   [2008]   [Sep]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 4/13] memcg: force_empty moving account
From
Date
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!



\
 
 \ /
  Last update: 2008-09-22 16:27    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site