[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9784a2ec-b778-2492-76fc-c5aef83b66ad@roeck-us.net>
Date: Fri, 5 Jun 2020 06:33:38 -0700
From: Guenter Roeck <linux@...ck-us.net>
To: Peter Zijlstra <peterz@...radead.org>
Cc: tglx@...utronix.de, frederic@...nel.org,
linux-kernel@...r.kernel.org, x86@...nel.org, cai@....pw,
mgorman@...hsingularity.net
Subject: Re: [RFC][PATCH 7/7] sched: Replace rq::wake_list
On 6/5/20 1:10 AM, Peter Zijlstra wrote:
> On Thu, Jun 04, 2020 at 07:18:37AM -0700, Guenter Roeck wrote:
>> On Tue, May 26, 2020 at 06:11:04PM +0200, Peter Zijlstra wrote:
>
>>> + BUILD_BUG_ON(offsetof(struct task_struct, wake_entry_type) - offsetof(struct task_struct, wake_entry) !=
>>> + offsetof(struct __call_single_data, flags) - offsetof(struct __call_single_data, llist));
>>> +
>>
>> There is no guarantee in C that
>>
>> type1 a;
>> type2 b;
>>
>> in two different data structures means that offsetof(b) - offsetof(a)
>> is the same in both data structures unless attributes such as
>> __attribute__((__packed__)) are used.
>
> Do tell more; the alignment requirements and size of the types remains
> the same, this resulting in different layout is unlikely.
>
I have not made the C standard. You point out yourself a possible explicit
culprit: struct randomization. That by itself shows that you can not rely
on two elements of different structures having the same alignment,
which is pretty much exactly what I said (and may explain why observing
the problem seemed to at least somewhat depend on the weather).
> I found this excellent quote on Hacker News this morning:
>
> "I think the attitude of compiler writers is a good reason to fix the
> spec so they can't keep ratfucking developers trying to get work done."
>
Qed.
Guenter
>> As result, this does and will cause a variety of build errors depending
>> on the compiler version and compile flags.
>
> The only thing I can think of that's actually a problem is that retarded
> struct randomization stuff.
>
> Anyway, I'll move cleaning it up a little higher on the todo list.
>
Powered by blists - more mailing lists