From: Oleg Nesterov <oleg@redhat.com>
To: Breno Leitao <leitao@debian.org>, Marco Elver <elver@google.com>,
Dmitry Vyukov <dvyukov@google.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>,
Christian Brauner <brauner@kernel.org>,
mjguzik@gmail.com, josh@joshtriplett.org, Jan Kara <jack@suse.cz>,
jlayton@kernel.org, axboe@kernel.dk, shakeel.butt@linux.dev,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-team@meta.com
Subject: Re: [PATCH v4] fs/pipe: unify the page pools into a single per-pipe pool
Date: Mon, 20 Jul 2026 13:53:13 +0200 [thread overview]
Message-ID: <al4MKZc7AqcUUN5i@redhat.com> (raw)
In-Reply-To: <al3w54SsdZEjKVj4@gmail.com>
On 07/20, Breno Leitao wrote:
>
> On Fri, Jul 17, 2026 at 06:19:45PM +0200, Oleg Nesterov wrote:
> >
> > And READ_ONCE() is enough correctness wise.
> >
> > But AFAIK it is not enough to make KCSAN happy. anon_pipe_prealloc_pop/push
> > which modify ->count under pipe->mutex need WRITE_ONCE() to please KCSAN.
> >
> > Or anon_pipe_prefill_and_lock() can use data_race(READ_ONCE()).
>
> I am not sure that is correct. I got the impression if the reading side
> has READ_ONCE or data_race(), that is enough to please KCSAN.
And quite possibly I am wrong! I was never able to convince myself I
understand the should_watch() logic. See below.
> I will respin with, an additional "__data_racy" attribute in `count`
>
> struct anon_pipe_prealloc {
> struct page *pages[PIPE_PREALLOC_MAX];
> unsigned int __data_racy count;
Ah! I didn't even know we have __data_racy. Much better than what I suggested.
I see you have already sent V5 and it looks good to me.
----------------------------------------------------------------------------
But just for my education, let me abuse this thread and ask KCSAN maintainers
to shed a light...
Marco, Dmitry. to simplify, suppose we have something like
int DATA;
struct mutex LOCK;
void set(void)
{
mutex_lock(&LOCK);
DATA++;
mutex_unlock(&LOCK);
}
int get(void)
{
return READ_ONCE(DATA);
}
My understanding is that KCSAN can complain if get() races with set(),
READ_ONCE() in get() is not enough.
Is it correct?
Oleg.
prev parent reply other threads:[~2026-07-20 11:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-10 10:31 [PATCH v4] fs/pipe: unify the page pools into a single per-pipe pool Breno Leitao
2026-07-17 16:19 ` Oleg Nesterov
2026-07-20 10:05 ` Breno Leitao
2026-07-20 11:53 ` Oleg Nesterov [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=al4MKZc7AqcUUN5i@redhat.com \
--to=oleg@redhat.com \
--cc=axboe@kernel.dk \
--cc=brauner@kernel.org \
--cc=dvyukov@google.com \
--cc=elver@google.com \
--cc=jack@suse.cz \
--cc=jlayton@kernel.org \
--cc=josh@joshtriplett.org \
--cc=kernel-team@meta.com \
--cc=leitao@debian.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mjguzik@gmail.com \
--cc=shakeel.butt@linux.dev \
--cc=viro@zeniv.linux.org.uk \
/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.