Re: [GIT PULL] percpu fix for v5.9-rc6

From: Arvind Sankar
Date: Fri Sep 18 2020 - 16:29:14 EST


On Fri, Sep 18, 2020 at 01:14:54PM -0700, Linus Torvalds wrote:
> On Fri, Sep 18, 2020 at 1:02 PM Matthew Wilcox <willy@xxxxxxxxxxxxx> wrote:
> >
> > I suppose it's not really necessary, we could do offsetof here, right?
>
> Yup, that would make a lot more sense.
>
> But right now, the sizeof() obviously silently works.

In general (i.e. outside the implementation of the macro itself), what
is the preferred way of getting the size of just the header?
1) offsetof(typeof(s),flex)
2) struct_size(s, flex, 0)
3) sizeof(s)
4) new macro that's easier to read than 1 or 2, but makes it clear
what you're doing?