Messages in this thread | | | Subject | Re: [PATCH 3/3] KVM: x86/vPMU: Add lazy mechanism to release perf_event per vPMC | From | Like Xu <> | Date | Tue, 1 Oct 2019 20:33:45 +0800 |
| |
Hi Peter,
On 2019/10/1 16:23, Peter Zijlstra wrote: > On Mon, Sep 30, 2019 at 03:22:57PM +0800, Like Xu wrote: >> + union { >> + u8 event_count :7; /* the total number of created perf_events */ >> + bool enable_cleanup :1; > > That's atrocious, don't ever create a bitfield with base _Bool.
I saw this kind of usages in the tree such as "struct arm_smmu_master/tipc_mon_state/regmap_irq_chip".
I'm not sure is this your personal preference or is there a technical reason such as this usage is not incompatible with union syntax?
My design point is to save a little bit space without introducing two variables such as "int event_count & bool enable_cleanup".
One of the alternatives is to introduce "u8 pmu_state", where the last seven bits are event_count for X86_PMC_IDX_MAX and the highest bit is the enable_cleanup bit. Are you OK with this ?
By the way, is the lazy release mechanism looks reasonable to you?
> >> + } state; >
| |