On Thu, Oct 29, 2026 at 11:15:23AM -0600, James Hilliard wrote:
On Thu, Oct 29, 2026 at 8:19 AM Andy Shevchenko
[off-list ref] wrote:
quoted
On Thu, Oct 29, 2026 at 01:37:00AM -0600, James Hilliard wrote:
...
quoted
quoted
- bool shutting_down;
+ bool shutting_down:1;
+ bool tx_terminating:1;
+ bool tx_flushed:1;
What is the meaning of bool XXX:1? Have you checked with `pahole` the result?
These are one-bit boolean fields, intended to pack the state flags
into one byte.
I've now compared layout probes using the kernel type definitions and
saved build flags, changing only those bitfields to ordinary bools.
For the complete v8 structure, including the RX flags, pahole reports:
Bitfields Plain bool
ARM32 / Clang 212 220
ARM64 / GCC 368 376
ARM64 / GCC / PREEMPT_RT 368 376
The sizes are in bytes. All six flags share one byte in the packed
version. This saves eight bytes in each checked configuration.
Thanks for checking!
The packing is a layout choice, not an atomicity mechanism; updates
still require the UART port lock. Given the measured saving, I'd keep
it unless there is another concern with using bool bitfields here.
I'm just worrying that bool bitfields are implementation defined and
might have some side-effects. But I see elsewhere in the kernel similar
approach, so I guess so far it didn't trigger any suspicious behaviour.
--
With Best Regards,
Andy Shevchenko