lkml.org 
[lkml]   [2014]   [May]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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.
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2014-05-15 16:01    [W:0.156 / U:0.044 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site