[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK7LNAQez0wm4keBfqwn82ynvpYETD4fo9wD6WceBj-65F6dqg@mail.gmail.com>
Date: Sat, 30 Apr 2022 03:30:26 +0900
From: Masahiro Yamada <masahiroy@...nel.org>
To: Nick Desaulniers <ndesaulniers@...gle.com>
Cc: Linux Kbuild mailing list <linux-kbuild@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Michal Marek <michal.lkml@...kovi.net>
Subject: Re: [PATCH 06/27] modpost: use bool type where appropriate
On Tue, Apr 26, 2022 at 3:56 AM Nick Desaulniers
<ndesaulniers@...gle.com> wrote:
>
> On Mon, Apr 25, 2022 at 11:34 AM Nick Desaulniers
> <ndesaulniers@...gle.com> wrote:
> >
> > /On Sun, Apr 24, 2022 at 12:09 PM Masahiro Yamada <masahiroy@...nel.org> wrote:
> > >
> > > Signed-off-by: Masahiro Yamada <masahiroy@...nel.org>
> > > ---
> > >
> > > scripts/mod/modpost.c | 60 +++++++++++++++++++++----------------------
> > > scripts/mod/modpost.h | 10 ++++----
> > > 2 files changed, 35 insertions(+), 35 deletions(-)
> > >
> > > diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
> > > index f9cbb6b6b7a5..52dd07a36379 100644
> > > --- a/scripts/mod/modpost.c
> > > +++ b/scripts/mod/modpost.c
> > > @@ -203,10 +203,10 @@ struct symbol {
> > > struct symbol *next;
> > > struct module *module;
> > > unsigned int crc;
> > > - int crc_valid;
> > > + bool crc_valid;
> > > char *namespace;
> > > - unsigned int weak:1;
> > > - unsigned int is_static:1; /* 1 if symbol is not global */
> > > + bool weak;
> > > + bool is_static; /* true if symbol is not global */
> > > enum export export; /* Type of export */
> > > char name[];
> > > };
>
> This will change the sizeof(struct symbol). I'm guessing we have lots
> of symbols to process? If we have many live at once, perhaps it would
> be better to keep these as bitfields, but additionally move them to
> the end of the struct definition so as to save space?
Not really.
On 64 bit systems, sizeof(struct symbol) is still 40 bytes.
We may save some space by using bit fields and pahole analysis,
but I do not think that is a big deal for userspace programs.
I tend to prioritize code readability.
--
Best Regards
Masahiro Yamada
Powered by blists - more mailing lists