[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140515132945.GM13658@twins.programming.kicks-ass.net>
Date: Thu, 15 May 2014 15:29:45 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Mel Gorman <mgorman@...e.de>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Oleg Nesterov <oleg@...hat.com>,
Johannes Weiner <hannes@...xchg.org>,
Vlastimil Babka <vbabka@...e.cz>, Jan Kara <jack@...e.cz>,
Michal Hocko <mhocko@...e.cz>, Hugh Dickins <hughd@...gle.com>,
Dave Hansen <dave.hansen@...el.com>,
Linux Kernel <linux-kernel@...r.kernel.org>,
Linux-MM <linux-mm@...ck.org>,
Linux-FSDevel <linux-fsdevel@...r.kernel.org>,
Paul McKenney <paulmck@...ux.vnet.ibm.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
David Howells <dhowells@...hat.com>
Subject: Re: [PATCH] mm: filemap: Avoid unnecessary barries and waitqueue
lookups in unlock_page fastpath v4
On Thu, May 15, 2014 at 03:20:58PM +0200, Peter Zijlstra wrote:
> void __unlock_page(struct page *page)
> {
> struct wait_bit_key key = __WAIT_BIT_KEY_INITIALIZER(&page->flags, PG_locked);
> struct wait_queue_head_t *wqh = page_waitqueue(page);
> wait_queue_t *curr;
if (!PG_waiters && !waitqueue_active(wqh))
return;
> spin_lock_irq(&wqh->lock);
> list_for_each_entry(curr, &wqh->task_list, task_list) {
> unsigned int flags = curr->flags;
>
> if (curr->func(curr, TASK_NORMAL, 0, &key))
> goto unlock;
> }
> ClearPageWaiters(page);
> unlock:
> spin_unlock_irq(&wqh->lock);
> }
>
> Yes, the __unlock_page() will have the unconditional wqh->lock, but it
> should also call __unlock_page() a lot less, and it doesn't have that
> horrid timeout.
>
> Now, the above is clearly sub-optimal when !extended_page_flags, but I
> suppose we could have two versions of __unlock_page() for that.
Or I suppose the above would fix it too.
Content of type "application/pgp-signature" skipped
Powered by blists - more mailing lists