lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAK7LNATFPWRaQb876p4=5K0H-Uc7KCLsVNnYVdxSypzmmfSv9A@mail.gmail.com>
Date:   Tue, 21 Nov 2023 11:20:50 +0900
From:   Masahiro Yamada <masahiroy@...nel.org>
To:     Andi Kleen <ak@...ux.intel.com>
Cc:     linux-kbuild@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] kbuild: Add inline-account tool

On Tue, Nov 21, 2023 at 5:08 AM Andi Kleen <ak@...ux.intel.com> wrote:
>
> >
> > > +    sym_sizes = [syms[x + 1] - syms[x] for x, _ in enumerate(syms[:-1])]
> > > +    sym_total = sum(sym_sizes)
> >
> >
> > This is equivalent to
> >
> >       sym_total = syms[-1] - syms[0]
> >
> > isn't it?
>
> No it's not when there are gaps in the symbols, which always happens in
> the kernel.  The previous version used the range but that led to inbalances.



I do not understand because there is nothing to handle gaps
in your code.


get_syms() appends only 'pc' into the list.


Then,

  sym_sizes = [syms[x + 1] - syms[x] for x, _ in enumerate(syms[:-1])]


computes each symbol size by:

   (address of the next symbol) - (address of the current symbol).


So, your code is equivalent to:

   sym_total = syms[-1] - syms[0]










> > def get_ranges(syms, threads):
> >
> >     ranges = []
> >     prev = syms[0]
> >     i = 1
> >
> >     while threads > 0:
> >
> >         boundary = prev + 1 + (syms[-1] - prev - 1) // threads
> >
> >         while syms[i] < boundary:
> >             i += 1
>
>
> Note the boundary is not the address, but the sum of symbol sizes
>
>
> -Andi

--
Best Regards
Masahiro Yamada

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ