Re: [PATCH] Fix __wait_on_atomic_t() to call the action func if the counter != 0

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 23 Jul 2013 17:15:02 +0100
David Howells <dhowells@xxxxxxxxxx> wrote:

> Jeff Layton <jlayton@xxxxxxxxxx> wrote:
> 
> > > @@ -333,7 +333,8 @@ int __wait_on_atomic_t(wait_queue_head_t *wq, struct wait_bit_queue *q,
> > >  		prepare_to_wait(wq, &q->wait, mode);
> > >  		val = q->key.flags;
> > >  		if (atomic_read(val) == 0)
> > > -			ret = (*action)(val);
> > > +			break;
> > > +		ret = (*action)(val);
> > >  	} while (!ret && atomic_read(val) != 0);
> > 
> > nit: can you now eliminate the check for "val" in the while condition?
> > It doesn't look like it harms anything, but eliminating it would
> > probably simplify the code slightly...
> 
> Its presence means that we don't have to call prepare_to_wait() again if val
> became 0.
> 
> David

Ok, and prepare_to_wait involves taking spinlocks, etc...

Got it!

Reviewed-by: Jeff Layton <jlayton@xxxxxxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux