Thread (67 messages) 67 messages, 9 authors, 2025-04-04

Re: [PATCH v3 00/16] Introduce and use generic parity16/32/64 helper

From: Yury Norov <yury.norov@gmail.com>
Date: 2025-03-07 15:55:15
Also in: bpf, dri-devel, linux-input, linux-media, linux-serial, linux-wireless, lkml

On Fri, Mar 07, 2025 at 07:57:48AM +0100, Jiri Slaby wrote:
On 06. 03. 25, 17:25, Kuan-Wei Chiu wrote:
quoted
Several parts of the kernel contain redundant implementations of parity
calculations for 16/32/64-bit values. Introduces generic
parity16/32/64() helpers in bitops.h, providing a standardized
and optimized implementation.

Subsequent patches refactor various kernel components to replace
open-coded parity calculations with the new helpers, reducing code
duplication and improving maintainability.

Co-developed-by: Yu-Chun Lin <redacted>
Signed-off-by: Yu-Chun Lin <redacted>
Signed-off-by: Kuan-Wei Chiu <visitorckw@gmail.com>
---
In v3, I use parityXX() instead of the parity() macro since the
parity() macro may generate suboptimal code and requires special hacks
to make GCC happy. If anyone still prefers a single parity() macro,
please let me know.
What is suboptimal and where exactly it matters? Have you actually measured
it?
I asked exactly this question at least 3 times, and have never
received perf tests or asm listings - nothing. I've never received
any comments from driver maintainers about how performance of the
parity() is important for them, as well.

With the absence of _any_ feedback, I'm not going to take this series,
of course, for the reason: overengineering.

With that said, the simplest way would be replacing parity8(u8) with
parity(u64) 'one size fits all' thing. I even made a one extra step,
suggesting a macro that would generate a better code for smaller types
with almost no extra maintenance burden. This is another acceptable
option to me.

Thanks,
Yury
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help