linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Vivek Goyal <vgoyal@redhat.com>
Cc: linux-fsdevel@vger.kernel.org, linux-nvdimm@lists.01.org,
	dan.j.williams@intel.com, linux-kernel@vger.kernel.org,
	virtio-fs@redhat.com, miklos@szeredi.hu, jack@suse.cz,
	slp@redhat.com, groug@kaod.org
Subject: Re: [PATCH v4 1/3] dax: Add an enum for specifying dax wakup mode
Date: Mon, 26 Apr 2021 19:02:11 +0100	[thread overview]
Message-ID: <20210426180211.GP235567@casper.infradead.org> (raw)
In-Reply-To: <20210426175217.GD1741690@redhat.com>

On Mon, Apr 26, 2021 at 01:52:17PM -0400, Vivek Goyal wrote:
> On Mon, Apr 26, 2021 at 02:46:32PM +0100, Matthew Wilcox wrote:
> > On Fri, Apr 23, 2021 at 09:07:21AM -0400, Vivek Goyal wrote:
> > > +enum dax_wake_mode {
> > > +	WAKE_NEXT,
> > > +	WAKE_ALL,
> > > +};
> > 
> > Why define them in this order when ...
> > 
> > > @@ -196,7 +207,7 @@ static void dax_wake_entry(struct xa_state *xas, void *entry, bool wake_all)
> > >  	 * must be in the waitqueue and the following check will see them.
> > >  	 */
> > >  	if (waitqueue_active(wq))
> > > -		__wake_up(wq, TASK_NORMAL, wake_all ? 0 : 1, &key);
> > > +		__wake_up(wq, TASK_NORMAL, mode == WAKE_ALL ? 0 : 1, &key);
> > 
> > ... they're used like this?  This is almost as bad as
> > 
> > enum bool {
> > 	true,
> > 	false,
> > };
> 
> Hi Matthew,
> 
> So you prefer that I should switch order of WAKE_NEXT and WAKE_ALL? 
> 
> enum dax_wake_mode {
> 	WAKE_ALL,
> 	WAKE_NEXT,
> };

That, yes.

> And then do following to wake task.
> 
> if (waitqueue_active(wq))
> 	__wake_up(wq, TASK_NORMAL, mode, &key);

No, the third argument to __wake_up() is a count, not an enum.  It just so
happens that '0' means 'all' and we only ever wake up 1 and not, say, 5.
So the logical way to define the enum is ALL, NEXT which _just happens
to match_ the usage of __wake_up().

  reply	other threads:[~2021-04-26 18:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-23 13:07 [PATCH v4 0/3] dax: Fix missed wakeup in put_unlocked_entry() Vivek Goyal
2021-04-23 13:07 ` [PATCH v4 1/3] dax: Add an enum for specifying dax wakup mode Vivek Goyal
2021-04-26 13:46   ` Matthew Wilcox
2021-04-26 17:52     ` Vivek Goyal
2021-04-26 18:02       ` Matthew Wilcox [this message]
2021-04-26 18:08         ` Vivek Goyal
2021-04-23 13:07 ` [PATCH v4 2/3] dax: Add a wakeup mode parameter to put_unlocked_entry() Vivek Goyal
2021-04-23 13:07 ` [PATCH v4 3/3] dax: Wake up all waiters after invalidating dax entry Vivek Goyal
2021-04-23 20:38 ` [PATCH v4 0/3] dax: Fix missed wakeup in put_unlocked_entry() Dan Williams

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=20210426180211.GP235567@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=dan.j.williams@intel.com \
    --cc=groug@kaod.org \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvdimm@lists.01.org \
    --cc=miklos@szeredi.hu \
    --cc=slp@redhat.com \
    --cc=vgoyal@redhat.com \
    --cc=virtio-fs@redhat.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;
as well as URLs for NNTP newsgroup(s).