lkml.org 
[lkml]   [2022]   [Sep]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v4 2/8] scripts/kallsyms: ensure that all possible combinations are compressed
On Tue 2022-09-20 15:13:11, Zhen Lei wrote:
> For a symbol, there may be more than one place that can be merged. For
> example: nfs_fs_proc_net_init, there are two "f"+"s_" combinations.
> And we're only compressing the first combination at the moment.

Really?

> diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c
> index 8caccc8f4a23703..3319d9f38d7a5f2 100644
> --- a/scripts/kallsyms.c
> +++ b/scripts/kallsyms.c
> @@ -553,7 +553,7 @@ static void compress_symbols(const unsigned char *str, int idx)
> unsigned char *p1, *p2;
>
> for (i = 0; i < table_cnt; i++) {
> -
> +retry:
> len = table[i]->len;
> p1 = table[i]->sym;
>
> @@ -585,6 +585,9 @@ static void compress_symbols(const unsigned char *str, int idx)
>
> /* increase the counts for this symbol's new tokens */
> learn_symbol(table[i]->sym, len);
> +
> + /* May be more than one place that can be merged, try again */
> + goto retry;
> }
> }

My understanding is that the code already tries to find the same
token several times. Here are the important parts of the existing
code:

static void compress_symbols(const unsigned char *str, int idx)
{

p2 = find_token(p1, len, str);

do {
/* replace the found token with idx */
*p2 = idx;
[...]

/* find the token on the symbol */
p2 = find_token(p1, size, str);

} while (p2);

Best Regards,
Petr

\
 
 \ /
  Last update: 2022-09-21 10:01    [W:0.149 / U:0.128 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site