On Mon, Mar 03 2025, Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote: > On Mon, 3 Mar 2025 at 10:28, Oleg Nesterov <oleg@xxxxxxxxxx> wrote: >> >> Stupid question... but do we really need to change the code which update >> tail/head if we pack them into a single word? > > No. It's only the READ_ONCE() parts that need changing. > > See this suggested patch, which does something very similar to what > you were thinking of. > > +/* > + * 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/ Rasmus