On Thu, 6 Mar 2025 at 05:33, K Prateek Nayak <kprateek.nayak@xxxxxxx> wrote: > >> > >> 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. Yes, I was going to say the same - please don't change to 'unsigned short'. Judicious use of 'pipe_index_t' may be a good idea, but as I fixed some issues Rasmus found, I was also looking at the generated code, and on at least x86 where 16-bit generates extra instructions and prefixes, it seems marginally better to treat the values as 32-bit, and then only do the compares in 16 bits. That only causes a few "movzwl" instructions (at load time), and then the occasional "cmpw" (empty check) and "movw" (store) etc. But I only did a very quick "let's look at a few cases of x86-64 also using a 16-bit pipe_index_t". So for testing purposes your patch looks fine, but not as something to apply. If anything, I think we should actively try to remove as many direct accesses to these pipe fields as humanly possible. As Oleg said, a lot of them should just be cleaned up to use the helpers we already have. Rasmus found a few cases of that already, like that FIONREAD case where it was just doing a lot of open-coding of things that shouldn't be open-coded. I've fixed the two cases he pointed at up as obvious bugs, but it would be good to see where else issues like this might lurk. Linus