mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@redhat.com>
To: David Howells <dhowells@redhat.com>
Cc: torvalds@linux-foundation.org, linux-nfs@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-cachefs@redhat.com,
	Milosz Tanski <milosz@adfin.com>,
	Yacine Belkadi <yacine.belkadi.1@gmail.com>
Subject: Re: [PATCH] Fix __wait_on_atomic_t() to call the action func if the counter != 0
Date: Tue, 23 Jul 2013 12:26:29 -0400	[thread overview]
Message-ID: <20130723122629.6b5ae46e@tlielax.poochiereds.net> (raw)
In-Reply-To: <24785.1374596102@warthog.procyon.org.uk>

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

> Jeff Layton <jlayton@redhat.com> 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@redhat.com>

      reply	other threads:[~2013-07-23 16:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-23 15:49 David Howells
2013-07-23 16:02 ` Jeff Layton
2013-07-23 16:15 ` David Howells
2013-07-23 16:26   ` Jeff Layton [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130723122629.6b5ae46e@tlielax.poochiereds.net \
    --to=jlayton@redhat.com \
    --cc=dhowells@redhat.com \
    --cc=linux-cachefs@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=milosz@adfin.com \
    --cc=torvalds@linux-foundation.org \
    --cc=yacine.belkadi.1@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®