lkml.org 
[lkml]   [2014]   [May]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] mm: filemap: Avoid unnecessary barriers and waitqueue lookups in unlock_page fastpath v7
On Thu, May 22, 2014 at 03:40:45PM +0100, Mel Gorman wrote:

> > +static bool __wake_up_common(wait_queue_head_t *q, unsigned int mode,
> > int nr_exclusive, int wake_flags, void *key)
> > {
> > wait_queue_t *curr, *next;
> > + bool woke = false;
> >
> > list_for_each_entry_safe(curr, next, &q->task_list, task_list) {
> > unsigned flags = curr->flags;
> >
> > + if (curr->func(curr, mode, wake_flags, key)) {
> > + woke = true;
> > + if ((flags & WQ_FLAG_EXCLUSIVE) && !--nr_exclusive)
> > + break;
> > + }
> > }
> > +
> > + return woke;
>
> Ok, thinking about this more I'm less sure.
>
> There are cases where the curr->func returns false even though there is a
> task that needs to run -- task was already running or preparing to run. We
> potentially end up clearing PG_waiters while there are still tasks on the
> waitqueue. As __finish_wait checks if the waitqueue is empty and the last
> waiter clears the bit I think there is nothing to gain by trying to do the
> same job in __wake_up_page_bit.

Hmm, I think you're right, we need the test result from
wake_bit_function(), unpolluted by the ttwu return value.
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2014-05-22 17:41    [W:0.497 / U:1.476 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site