Re: [RFC PATCH 18/23] sched/task_struct: Add helpers for task classification

Ricardo Neri
2022-10-08T00:32:02Z

On Tue, Sep 27, 2022 at 01:52:24PM +0200, Peter Zijlstra wrote:
> On Fri, Sep 09, 2022 at 04:12:00PM -0700, Ricardo Neri wrote:
>
> > #ifdef CONFIG_SCHED_TASK_CLASSES
> > short class;
> > + short class_candidate;
> > + char class_debounce_counter;
> > #endif

>
> That's 5 bytes; is that really needed? 4 would be so much better :-)

It can probably be implemented as:

u32 class : 9,
class_candidate : 9,
class_debounce_counter : 14;

9 bits accommodate the 256 possible classes + 'unclassified' that the
existing hardware can support (I doubt there will ever be this many
classes). The remainder bits can be used for debouncing, or even have
some reserved for future use.

Thanks and BR,
Ricardo