On 2015-04-15 08:10, Zhangjun (V) wrote:
> Hi all,
>
> In per_cpu structure, there are lots of members described the cpu state.
>
> Such as, bool initialized, volatile bool suspend_cpu, volatile bool wait_for_sipi, volatile bool cpu_suspended.
>
> Can we merge these numbers to a number?
>
> Code like this:
>
> Struct per_cpu {
>
> u8 stack[PAGE_SIZE];
>
> ...
> /** cpu state*/
>
> U8 cpu_state;
> ...
> };
>
> Enum cpu_state {
> INITIALIZED = 0,
> SUSPEND,
> WAIT_FOR_SIPI,
> SHUTDOWN,
> };
>
> Cpu_data->cpu_state = INITIALIZED;
>
Some of these fields may have different locking requirements, some are
signaling flags, other may be required arch-independently. All that has
to be checked carefully. But I wouldn't be surprised if we could
consolidate some state variables. Cleanup patches are always welcome!
Maybe start with the simpler cases first (the non-volatile vars,
specifically).
Jan
--
Siemens AG, Corporate Technology, CT RTC ITP SES-DE
Corporate Competence Center Embedded Linux