[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <39574d99-51a2-4314-989e-6331ca7c0d75@amd.com>
Date: Thu, 6 Mar 2025 21:03:17 +0530
From: K Prateek Nayak <kprateek.nayak@....com>
To: Oleg Nesterov <oleg@...hat.com>, Rasmus Villemoes <ravi@...vas.dk>
CC: Linus Torvalds <torvalds@...ux-foundation.org>, Miklos Szeredi
<miklos@...redi.hu>, Alexander Viro <viro@...iv.linux.org.uk>, "Christian
Brauner" <brauner@...nel.org>, Andrew Morton <akpm@...ux-foundation.org>,
"Hugh Dickins" <hughd@...gle.com>, <linux-fsdevel@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <linux-mm@...ck.org>, Jan Kara
<jack@...e.cz>, "Matthew Wilcox (Oracle)" <willy@...radead.org>, "Mateusz
Guzik" <mjguzik@...il.com>, "Gautham R. Shenoy" <gautham.shenoy@....com>,
<Neeraj.Upadhyay@....com>, <Ananth.narayan@....com>, Swapnil Sapkal
<swapnil.sapkal@....com>
Subject: Re: [RFC PATCH 3/3] treewide: pipe: Convert all references to
pipe->{head,tail,max_usage,ring_size} to unsigned short
Hello Oleg, Rasmus,
On 3/6/2025 6:11 PM, Oleg Nesterov wrote:
> On 03/06, Oleg Nesterov wrote:
>>
>> On 03/06, K Prateek Nayak wrote:
>>>
>>> @@ -272,9 +272,9 @@ pipe_read(struct kiocb *iocb, struct iov_iter *to)
>>> */
>>> for (;;) {
>>> /* Read ->head with a barrier vs post_one_notification() */
>>> - unsigned int head = smp_load_acquire(&pipe->head);
>>> - unsigned int tail = pipe->tail;
>>> - unsigned int mask = pipe->ring_size - 1;
>>> + unsigned short head = smp_load_acquire(&pipe->head);
>>> + unsigned short tail = pipe->tail;
>>> + unsigned short mask = pipe->ring_size - 1;
>>
>> I dunno... but if we do this, perhaps we should
>> s/unsigned int/pipe_index_t instead?
>>
>> At least this would be more grep friendly.
Ack. I'll leave the typedef untouched and convert these to use
pipe_index_t. This was an experiment so see if anything breaks with u16
conversion just to get more testing on that scenario. As Rasmus
mentioned, leaving the head and tail as u32 on 64bit will lead to
better code generation.
>
> in any case, I think another cleanup before this change makes sense...
> pipe->ring_size is overused. pipe_read(), pipe_write() and much more
> users do not need "unsigned int mask", they can use pipe_buf(buf, slot)
> instead.
Ack. I'll add a cleanup patch ahead of this conversion. Thank you both
for taking a look.
>
> Oleg.
>
--
Thanks and Regards,
Prateek
Powered by blists - more mailing lists