From: Greg Kurz <groug@kaod.org>
To: Vivek Goyal <vgoyal@redhat.com>
Cc: linux-fsdevel@vger.kernel.org, jack@suse.cz, willy@infradead.org,
linux-nvdimm@lists.01.org, miklos@szeredi.hu,
linux-kernel@vger.kernel.org, virtio-fs@redhat.com
Subject: Re: [Virtio-fs] [PATCH v3 1/3] dax: Add an enum for specifying dax wakup mode
Date: Tue, 20 Apr 2021 09:19:25 +0200 [thread overview]
Message-ID: <20210420091925.08054e8b@bahia.lan> (raw)
In-Reply-To: <20210419213636.1514816-2-vgoyal@redhat.com>
On Mon, 19 Apr 2021 17:36:34 -0400
Vivek Goyal <vgoyal@redhat.com> wrote:
> Dan mentioned that he is not very fond of passing around a boolean true/false
> to specify if only next waiter should be woken up or all waiters should be
> woken up. He instead prefers that we introduce an enum and make it very
> explicity at the callsite itself. Easier to read code.
>
> This patch should not introduce any change of behavior.
>
> Suggested-by: Dan Williams <dan.j.williams@intel.com>
> Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
> ---
Reviewed-by: Greg Kurz <groug@kaod.org>
> fs/dax.c | 23 +++++++++++++++++------
> 1 file changed, 17 insertions(+), 6 deletions(-)
>
> diff --git a/fs/dax.c b/fs/dax.c
> index b3d27fdc6775..00978d0838b1 100644
> --- a/fs/dax.c
> +++ b/fs/dax.c
> @@ -144,6 +144,16 @@ struct wait_exceptional_entry_queue {
> struct exceptional_entry_key key;
> };
>
> +/**
> + * enum dax_entry_wake_mode: waitqueue wakeup toggle
> + * @WAKE_NEXT: entry was not mutated
> + * @WAKE_ALL: entry was invalidated, or resized
> + */
> +enum dax_entry_wake_mode {
> + WAKE_NEXT,
> + WAKE_ALL,
> +};
> +
> static wait_queue_head_t *dax_entry_waitqueue(struct xa_state *xas,
> void *entry, struct exceptional_entry_key *key)
> {
> @@ -182,7 +192,8 @@ static int wake_exceptional_entry_func(wait_queue_entry_t *wait,
> * The important information it's conveying is whether the entry at
> * this index used to be a PMD entry.
> */
> -static void dax_wake_entry(struct xa_state *xas, void *entry, bool wake_all)
> +static void dax_wake_entry(struct xa_state *xas, void *entry,
> + enum dax_entry_wake_mode mode)
> {
> struct exceptional_entry_key key;
> wait_queue_head_t *wq;
> @@ -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);
> }
>
> /*
> @@ -268,7 +279,7 @@ static void put_unlocked_entry(struct xa_state *xas, void *entry)
> {
> /* If we were the only waiter woken, wake the next one */
> if (entry && !dax_is_conflict(entry))
> - dax_wake_entry(xas, entry, false);
> + dax_wake_entry(xas, entry, WAKE_NEXT);
> }
>
> /*
> @@ -286,7 +297,7 @@ static void dax_unlock_entry(struct xa_state *xas, void *entry)
> old = xas_store(xas, entry);
> xas_unlock_irq(xas);
> BUG_ON(!dax_is_locked(old));
> - dax_wake_entry(xas, entry, false);
> + dax_wake_entry(xas, entry, WAKE_NEXT);
> }
>
> /*
> @@ -524,7 +535,7 @@ static void *grab_mapping_entry(struct xa_state *xas,
>
> dax_disassociate_entry(entry, mapping, false);
> xas_store(xas, NULL); /* undo the PMD join */
> - dax_wake_entry(xas, entry, true);
> + dax_wake_entry(xas, entry, WAKE_ALL);
> mapping->nrexceptional--;
> entry = NULL;
> xas_set(xas, index);
> @@ -937,7 +948,7 @@ static int dax_writeback_one(struct xa_state *xas, struct dax_device *dax_dev,
> xas_lock_irq(xas);
> xas_store(xas, entry);
> xas_clear_mark(xas, PAGECACHE_TAG_DIRTY);
> - dax_wake_entry(xas, entry, false);
> + dax_wake_entry(xas, entry, WAKE_NEXT);
>
> trace_dax_writeback_one(mapping->host, index, count);
> return ret;
_______________________________________________
Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org
To unsubscribe send an email to linux-nvdimm-leave@lists.01.org
WARNING: multiple messages have this Message-ID (diff)
From: Greg Kurz <groug@kaod.org>
To: Vivek Goyal <vgoyal@redhat.com>
Cc: jack@suse.cz, miklos@szeredi.hu, linux-nvdimm@lists.01.org,
linux-kernel@vger.kernel.org, willy@infradead.org,
virtio-fs@redhat.com, linux-fsdevel@vger.kernel.org,
dan.j.williams@intel.com
Subject: Re: [Virtio-fs] [PATCH v3 1/3] dax: Add an enum for specifying dax wakup mode
Date: Tue, 20 Apr 2021 09:19:25 +0200 [thread overview]
Message-ID: <20210420091925.08054e8b@bahia.lan> (raw)
In-Reply-To: <20210419213636.1514816-2-vgoyal@redhat.com>
On Mon, 19 Apr 2021 17:36:34 -0400
Vivek Goyal <vgoyal@redhat.com> wrote:
> Dan mentioned that he is not very fond of passing around a boolean true/false
> to specify if only next waiter should be woken up or all waiters should be
> woken up. He instead prefers that we introduce an enum and make it very
> explicity at the callsite itself. Easier to read code.
>
> This patch should not introduce any change of behavior.
>
> Suggested-by: Dan Williams <dan.j.williams@intel.com>
> Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
> ---
Reviewed-by: Greg Kurz <groug@kaod.org>
> fs/dax.c | 23 +++++++++++++++++------
> 1 file changed, 17 insertions(+), 6 deletions(-)
>
> diff --git a/fs/dax.c b/fs/dax.c
> index b3d27fdc6775..00978d0838b1 100644
> --- a/fs/dax.c
> +++ b/fs/dax.c
> @@ -144,6 +144,16 @@ struct wait_exceptional_entry_queue {
> struct exceptional_entry_key key;
> };
>
> +/**
> + * enum dax_entry_wake_mode: waitqueue wakeup toggle
> + * @WAKE_NEXT: entry was not mutated
> + * @WAKE_ALL: entry was invalidated, or resized
> + */
> +enum dax_entry_wake_mode {
> + WAKE_NEXT,
> + WAKE_ALL,
> +};
> +
> static wait_queue_head_t *dax_entry_waitqueue(struct xa_state *xas,
> void *entry, struct exceptional_entry_key *key)
> {
> @@ -182,7 +192,8 @@ static int wake_exceptional_entry_func(wait_queue_entry_t *wait,
> * The important information it's conveying is whether the entry at
> * this index used to be a PMD entry.
> */
> -static void dax_wake_entry(struct xa_state *xas, void *entry, bool wake_all)
> +static void dax_wake_entry(struct xa_state *xas, void *entry,
> + enum dax_entry_wake_mode mode)
> {
> struct exceptional_entry_key key;
> wait_queue_head_t *wq;
> @@ -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);
> }
>
> /*
> @@ -268,7 +279,7 @@ static void put_unlocked_entry(struct xa_state *xas, void *entry)
> {
> /* If we were the only waiter woken, wake the next one */
> if (entry && !dax_is_conflict(entry))
> - dax_wake_entry(xas, entry, false);
> + dax_wake_entry(xas, entry, WAKE_NEXT);
> }
>
> /*
> @@ -286,7 +297,7 @@ static void dax_unlock_entry(struct xa_state *xas, void *entry)
> old = xas_store(xas, entry);
> xas_unlock_irq(xas);
> BUG_ON(!dax_is_locked(old));
> - dax_wake_entry(xas, entry, false);
> + dax_wake_entry(xas, entry, WAKE_NEXT);
> }
>
> /*
> @@ -524,7 +535,7 @@ static void *grab_mapping_entry(struct xa_state *xas,
>
> dax_disassociate_entry(entry, mapping, false);
> xas_store(xas, NULL); /* undo the PMD join */
> - dax_wake_entry(xas, entry, true);
> + dax_wake_entry(xas, entry, WAKE_ALL);
> mapping->nrexceptional--;
> entry = NULL;
> xas_set(xas, index);
> @@ -937,7 +948,7 @@ static int dax_writeback_one(struct xa_state *xas, struct dax_device *dax_dev,
> xas_lock_irq(xas);
> xas_store(xas, entry);
> xas_clear_mark(xas, PAGECACHE_TAG_DIRTY);
> - dax_wake_entry(xas, entry, false);
> + dax_wake_entry(xas, entry, WAKE_NEXT);
>
> trace_dax_writeback_one(mapping->host, index, count);
> return ret;
WARNING: multiple messages have this Message-ID (diff)
From: Greg Kurz <groug@kaod.org>
To: Vivek Goyal <vgoyal@redhat.com>
Cc: <linux-fsdevel@vger.kernel.org>, <dan.j.williams@intel.com>,
<jack@suse.cz>, <willy@infradead.org>,
<linux-nvdimm@lists.01.org>, <miklos@szeredi.hu>,
<linux-kernel@vger.kernel.org>, <virtio-fs@redhat.com>
Subject: Re: [Virtio-fs] [PATCH v3 1/3] dax: Add an enum for specifying dax wakup mode
Date: Tue, 20 Apr 2021 09:19:25 +0200 [thread overview]
Message-ID: <20210420091925.08054e8b@bahia.lan> (raw)
In-Reply-To: <20210419213636.1514816-2-vgoyal@redhat.com>
On Mon, 19 Apr 2021 17:36:34 -0400
Vivek Goyal <vgoyal@redhat.com> wrote:
> Dan mentioned that he is not very fond of passing around a boolean true/false
> to specify if only next waiter should be woken up or all waiters should be
> woken up. He instead prefers that we introduce an enum and make it very
> explicity at the callsite itself. Easier to read code.
>
> This patch should not introduce any change of behavior.
>
> Suggested-by: Dan Williams <dan.j.williams@intel.com>
> Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
> ---
Reviewed-by: Greg Kurz <groug@kaod.org>
> fs/dax.c | 23 +++++++++++++++++------
> 1 file changed, 17 insertions(+), 6 deletions(-)
>
> diff --git a/fs/dax.c b/fs/dax.c
> index b3d27fdc6775..00978d0838b1 100644
> --- a/fs/dax.c
> +++ b/fs/dax.c
> @@ -144,6 +144,16 @@ struct wait_exceptional_entry_queue {
> struct exceptional_entry_key key;
> };
>
> +/**
> + * enum dax_entry_wake_mode: waitqueue wakeup toggle
> + * @WAKE_NEXT: entry was not mutated
> + * @WAKE_ALL: entry was invalidated, or resized
> + */
> +enum dax_entry_wake_mode {
> + WAKE_NEXT,
> + WAKE_ALL,
> +};
> +
> static wait_queue_head_t *dax_entry_waitqueue(struct xa_state *xas,
> void *entry, struct exceptional_entry_key *key)
> {
> @@ -182,7 +192,8 @@ static int wake_exceptional_entry_func(wait_queue_entry_t *wait,
> * The important information it's conveying is whether the entry at
> * this index used to be a PMD entry.
> */
> -static void dax_wake_entry(struct xa_state *xas, void *entry, bool wake_all)
> +static void dax_wake_entry(struct xa_state *xas, void *entry,
> + enum dax_entry_wake_mode mode)
> {
> struct exceptional_entry_key key;
> wait_queue_head_t *wq;
> @@ -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);
> }
>
> /*
> @@ -268,7 +279,7 @@ static void put_unlocked_entry(struct xa_state *xas, void *entry)
> {
> /* If we were the only waiter woken, wake the next one */
> if (entry && !dax_is_conflict(entry))
> - dax_wake_entry(xas, entry, false);
> + dax_wake_entry(xas, entry, WAKE_NEXT);
> }
>
> /*
> @@ -286,7 +297,7 @@ static void dax_unlock_entry(struct xa_state *xas, void *entry)
> old = xas_store(xas, entry);
> xas_unlock_irq(xas);
> BUG_ON(!dax_is_locked(old));
> - dax_wake_entry(xas, entry, false);
> + dax_wake_entry(xas, entry, WAKE_NEXT);
> }
>
> /*
> @@ -524,7 +535,7 @@ static void *grab_mapping_entry(struct xa_state *xas,
>
> dax_disassociate_entry(entry, mapping, false);
> xas_store(xas, NULL); /* undo the PMD join */
> - dax_wake_entry(xas, entry, true);
> + dax_wake_entry(xas, entry, WAKE_ALL);
> mapping->nrexceptional--;
> entry = NULL;
> xas_set(xas, index);
> @@ -937,7 +948,7 @@ static int dax_writeback_one(struct xa_state *xas, struct dax_device *dax_dev,
> xas_lock_irq(xas);
> xas_store(xas, entry);
> xas_clear_mark(xas, PAGECACHE_TAG_DIRTY);
> - dax_wake_entry(xas, entry, false);
> + dax_wake_entry(xas, entry, WAKE_NEXT);
>
> trace_dax_writeback_one(mapping->host, index, count);
> return ret;
next prev parent reply other threads:[~2021-04-20 7:19 UTC|newest]
Thread overview: 62+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-19 21:36 [PATCH v3 0/3] dax: Fix missed wakeup in put_unlocked_entry() Vivek Goyal
2021-04-19 21:36 ` Vivek Goyal
2021-04-19 21:36 ` [Virtio-fs] " Vivek Goyal
2021-04-19 21:36 ` [PATCH v3 1/3] dax: Add an enum for specifying dax wakup mode Vivek Goyal
2021-04-19 21:36 ` Vivek Goyal
2021-04-19 21:36 ` [Virtio-fs] " Vivek Goyal
2021-04-20 7:19 ` Greg Kurz [this message]
2021-04-20 7:19 ` Greg Kurz
2021-04-20 7:19 ` Greg Kurz
2021-04-21 9:24 ` Jan Kara
2021-04-21 9:24 ` Jan Kara
2021-04-21 9:24 ` [Virtio-fs] " Jan Kara
2021-04-21 15:56 ` Vivek Goyal
2021-04-21 15:56 ` Vivek Goyal
2021-04-21 15:56 ` [Virtio-fs] " Vivek Goyal
2021-04-21 16:16 ` Matthew Wilcox
2021-04-21 16:16 ` Matthew Wilcox
2021-04-21 16:16 ` [Virtio-fs] " Matthew Wilcox
2021-04-21 17:21 ` Vivek Goyal
2021-04-21 17:21 ` Vivek Goyal
2021-04-21 17:21 ` [Virtio-fs] " Vivek Goyal
2021-04-19 21:36 ` [PATCH v3 2/3] dax: Add a wakeup mode parameter to put_unlocked_entry() Vivek Goyal
2021-04-19 21:36 ` Vivek Goyal
2021-04-19 21:36 ` [Virtio-fs] " Vivek Goyal
2021-04-20 7:34 ` Greg Kurz
2021-04-20 7:34 ` Greg Kurz
2021-04-20 14:00 ` Vivek Goyal
2021-04-20 14:00 ` Vivek Goyal
2021-04-20 14:00 ` Vivek Goyal
2021-04-21 19:09 ` Dan Williams
2021-04-21 19:09 ` Dan Williams
2021-04-21 19:09 ` Dan Williams
2021-04-21 19:13 ` Vivek Goyal
2021-04-21 19:13 ` Vivek Goyal
2021-04-21 19:13 ` Vivek Goyal
2021-04-22 6:24 ` Christoph Hellwig
2021-04-22 6:24 ` Christoph Hellwig
2021-04-22 6:24 ` Christoph Hellwig
2021-04-22 16:12 ` Darrick J. Wong
2021-04-22 16:12 ` Darrick J. Wong
2021-04-22 16:12 ` Darrick J. Wong
2021-04-22 20:01 ` Dan Williams
2021-04-22 20:01 ` Dan Williams
2021-04-22 20:01 ` Dan Williams
2021-04-22 20:07 ` Vivek Goyal
2021-04-22 20:07 ` Vivek Goyal
2021-04-22 20:07 ` Vivek Goyal
2021-05-17 17:10 ` Dan Williams
2021-05-17 17:10 ` Dan Williams
2021-05-17 17:10 ` Dan Williams
2021-04-21 17:39 ` Vivek Goyal
2021-04-21 17:39 ` Vivek Goyal
2021-04-21 17:39 ` Vivek Goyal
2021-04-21 9:25 ` Jan Kara
2021-04-21 9:25 ` Jan Kara
2021-04-21 9:25 ` [Virtio-fs] " Jan Kara
2021-04-19 21:36 ` [PATCH v3 3/3] dax: Wake up all waiters after invalidating dax entry Vivek Goyal
2021-04-19 21:36 ` Vivek Goyal
2021-04-19 21:36 ` [Virtio-fs] " Vivek Goyal
2021-04-21 9:26 ` Jan Kara
2021-04-21 9:26 ` Jan Kara
2021-04-21 9:26 ` [Virtio-fs] " Jan Kara
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=20210420091925.08054e8b@bahia.lan \
--to=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=vgoyal@redhat.com \
--cc=virtio-fs@redhat.com \
--cc=willy@infradead.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.