Re: [PATCH v13 12/32] x86,fs/resctrl: Support binary fixed point event counters

Luck, Tony
2025-11-10T16:52:57Z

On Wed, Nov 05, 2025 at 02:42:18PM +0000, Dave Martin wrote:
> > +static void print_event_value(struct seq_file *m, unsigned int binary_bits, u64 val)
> > +{
> > + unsigned long long frac;
> > + char buf[10];
>
> In place of the magic number 10, how about
> decplaces[MAX_BINARY_BITS] + 1 ?
>
> (I think the compiler should accept that as an initialiser if the array
> is const.)

The compiler (gcc 15.2.1) accepts without any warnings. But generates
different code.

sparse complains:
fs/resctrl/ctrlmondata.c:640:45: warning: Variable length array is used.

I may change the hard coded constant to 21 (guaranteed to be big enough
for a "long long" plus terminating NUL byte.)

-Tony