[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZVu8u+oofXO8iwyf@tassilo>
Date: Mon, 20 Nov 2023 12:08:50 -0800
From: Andi Kleen <ak@...ux.intel.com>
To: Masahiro Yamada <masahiroy@...nel.org>
Cc: linux-kbuild@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] kbuild: Add inline-account tool
>
> > + 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.
> 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
Powered by blists - more mailing lists