From: Bradley Morgan <bradley.morgan@linux.dev>
To: nilayvaish@google.com
Cc: brauner@kernel.org, dhowells@redhat.com,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] watch_queue: use page_private() accessors
Date: Tue, 24 Nov 2026 07:45:40 +0000 [thread overview]
Message-ID: <74B03DB4-CE55-410E-8E18-E6B8A02FFC26@linux.dev> (raw)
In-Reply-To: <20261124033740.833270-1-nilayvaish@google.com>
On 24 November 2026 03:37:40 GMT, Nilay Vaish <nilayvaish@google.com>
wrote:
>watch_queue records the number of the first note of each buffer page in
>page->private, reading and writing the field directly.
>
>struct page is being shrunk as part of the memdesc work, and its private
>field is one of those that will move. Direct users have to go through
>the accessors before that can happen.
>
>Use page_private() and set_page_private() instead, like the rest of the
>kernel, so that the code no longer depends on where struct page keeps
>the field.
>
>No functional change.
Cool!
I like this, makes sense.
Reviewed-by: Bradley Morgan <bradley.morgan@linux.dev>
>
>Signed-off-by: Nilay Vaish <nilayvaish@google.com>
>---
>
>Notes:
> This patch was written with the help of an AI coding assistant (Gemini).
>
> Based on next-20261123.
>
> kernel/watch_queue.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
>diff --git a/kernel/watch_queue.c b/kernel/watch_queue.c
>index e2bdd5fb0db1..eeb7fb9bc0fd 100644
>--- a/kernel/watch_queue.c
>+++ b/kernel/watch_queue.c
>@@ -71,7 +71,7 @@ static void watch_queue_pipe_buf_release(struct pipe_inode_info *pipe,
> bit /= WATCH_QUEUE_NOTE_SIZE;
>
> page = buf->page;
>- bit += page->private;
>+ bit += page_private(page);
>
> set_bit(bit, wqueue->notes_bitmap);
> generic_pipe_buf_release(pipe, buf);
>@@ -284,7 +284,7 @@ long watch_queue_set_size(struct pipe_inode_info *pipe, unsigned int nr_notes)
> pages[i] = alloc_page(GFP_KERNEL);
> if (!pages[i])
> goto error_p;
>- pages[i]->private = i * WATCH_QUEUE_NOTES_PER_PAGE;
>+ set_page_private(pages[i], i * WATCH_QUEUE_NOTES_PER_PAGE);
> }
>
> bitmap = bitmap_alloc(nr_notes, GFP_KERNEL);
>
>base-commit: 3191063649dbf7c0d0b768e1f3655e4c5fc6edb5
>prerequisite-patch-id: d52d42a2ec9ddc2b12b3412ec0d07254b417e60f
>prerequisite-patch-id: d8338f943ba7ae297eefbb26dabc3bcfe7994461
>prerequisite-patch-id: 3d99b53c242296b89d7f7b41f1995188f5a02369
>
--- Thanks!
prev parent reply other threads:[~2026-11-24 7:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-24 3:37 Nilay Vaish
2026-11-24 7:45 ` Bradley Morgan [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=74B03DB4-CE55-410E-8E18-E6B8A02FFC26@linux.dev \
--to=bradley.morgan@linux.dev \
--cc=brauner@kernel.org \
--cc=dhowells@redhat.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nilayvaish@google.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®