lkml.org 
[lkml]   [2022]   [Apr]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH 06/27] modpost: use bool type where appropriate
On Tue, Apr 26, 2022 at 3:56 AM Nick Desaulniers
<ndesaulniers@google.com> wrote:
>
> On Mon, Apr 25, 2022 at 11:34 AM Nick Desaulniers
> <ndesaulniers@google.com> wrote:
> >
> > /On Sun, Apr 24, 2022 at 12:09 PM Masahiro Yamada <masahiroy@kernel.org> wrote:
> > >
> > > Signed-off-by: Masahiro Yamada <masahiroy@kernel.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

\
 
 \ /
  Last update: 2022-04-29 20:33    [W:0.107 / U:1.964 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site