Re: [RFC][PATCH 7/7] sched: Replace rq::wake_list

From: Guenter Roeck
Date: Tue Jun 09 2020 - 19:03:28 EST


On 6/9/20 3:06 PM, Peter Zijlstra wrote:
> On Tue, Jun 09, 2020 at 02:38:29PM -0700, Eric Biggers wrote:
>> Does the struct actually have to be named? How about:
>>
>> diff --git a/include/linux/sched.h b/include/linux/sched.h
>> index c5d96e3e7fff42..14ca25cda19150 100644
>> --- a/include/linux/sched.h
>> +++ b/include/linux/sched.h
>> @@ -653,8 +653,14 @@ struct task_struct {
>> unsigned int ptrace;
>>
>> #ifdef CONFIG_SMP
>> - struct llist_node wake_entry;
>> - unsigned int wake_entry_type;
>> + /*
>> + * wake_entry_type must follow wake_entry, even when
>> + * CONFIG_GCC_PLUGIN_RANDSTRUCT=y.
>> + */
>> + struct {
>> + struct llist_node wake_entry;
>> + unsigned int wake_entry_type;
>> + };
>> int on_cpu;
>> #ifdef CONFIG_THREAD_INFO_IN_TASK
>> /* Current CPU: */
>>
>>
>> However, it would be preferable to not rely on different structs sharing the
>> same field order, but rather write proper C code that uses the same struct
>> everywhere to encapsulate these 2 fields...
>
> https://lkml.kernel.org/r/20200605093704.GB2948@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
>
> And I have more patches on top to clean up some of the anonymous union
> stuff, that that's quite a lot of frobbing.
>

That is why I tried to keep it simple as hackish fixup patch.

Guenter