RE: [PATCH] net : rps : supoort a single flow to use rps
From: David Laight
Date: Wed Jun 29 2022 - 05:09:47 EST
....
> I'd suggest to use some flags bitfield instead, so it would be way
> more scalable and at the same time have the pre-determined size. Ar
> per several LKML discussions, `bool` may have different size and
> logics depending on architecture and compiler, so when using it not
> on the stack inside a function, but in a structure, it might be not
> easy then to track cacheline layout etc.
> So, maybe
>
> unsigned long rps_flags;
> #define RPS_SINGLE_FLOW_ENABLE BIT(0)
>
> or even
>
> DECLARE_BITMAP(rps_flags);
> #define RPS_SINGLE_FLOW_ENABLE 0
I don't think BITMAPs are a good idea unless you really
need a lot of bits and (probably) locked accesses.
You can use C bitfields - the compiler doesn't (usually)
make too much of a 'pigs breakfast' of them unless you
needs to set/test multiple ones at the same time.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)