Re: [PATCH] pipe_read: don't wake up the writer if the pipe is still full
From: Linus Torvalds
Date: Wed Mar 05 2025 - 11:55:06 EST
On Wed, 5 Mar 2025 at 05:31, Rasmus Villemoes <ravi@xxxxxxxxx> wrote:
>
> On Mon, Mar 03 2025, Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
>
> > +/*
> > + * We have to declare this outside 'struct pipe_inode_info',
> > + * but then we can't use 'union pipe_index' for an anonymous
> > + * union, so we end up having to duplicate this declaration
> > + * below. Annoying.
> > + */
> > +union pipe_index {
> > + unsigned long head_tail;
> > + struct {
> > + pipe_index_t head;
> > + pipe_index_t tail;
> > + };
> > +};
> > +
>
> -fms-extensions ? Willy wanted to add that for use in mm/ some years ago
> [*], and it has come up a few other times as well.
>
> [*] https://lore.kernel.org/lkml/20180419152817.GD25406@xxxxxxxxxxxxxxxxxxxxxx/
Oh, I was unaware of that extension, and yes, it would have been
lovely here, avoiding that duplicate union declaration.
But it does require clang support - I see that clang has a
'-fms-extensions' as well, so it's presumably there.
I don't know if it's worth it for the (small handful) of cases we'd
have in the kernel, but it does seem useful.
Linus