Re: [GIT PULL] pipe: nonblocking rw for io_uring

From: Linus Torvalds
Date: Tue Apr 25 2023 - 16:29:51 EST


On Tue, Apr 25, 2023 at 12:58 PM Linus Torvalds
<torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
>
> Ok. I'll try to remember this, but maybe it might be worth documenting.

We might document it by just making it clear that it's not that we
want to read it "once", it's that we want to have a stable value.

There might be other situations where that is all we want.

IOW, maybe we could have something like

#define READ_STABLE(x) \
({ __auto_type __val = (x); OPTIMIZER_HIDE_VAR(__val); __val; })

instead - although from a quick look, the code generation is pretty
much exactly the same.

I dunno. Just throwing that idea out there as a "if reading _once_
isn't the issue, maybe we shouldn't make the code look like it is"...

Linus