diff mbox series

[v2,dwarves,4/8] btf_encoder: discard CUs after BTF encoding

Message ID 20201008234000.740660-5-andrii@kernel.org (mailing list archive)
State Not Applicable
Headers show
Series None | expand

Commit Message

Andrii Nakryiko Oct. 8, 2020, 11:39 p.m. UTC
From: Andrii Nakryiko <andriin@fb.com>

When doing BTF encoding/deduping, DWARF CUs are never used after BTF encoding
is done, so there is no point in wasting memory and keeping them in memory. So
discard them immediately.

Signed-off-by: Andrii Nakryiko <andriin@fb.com>
---
 pahole.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Arnaldo Carvalho de Melo Oct. 9, 2020, 3:47 p.m. UTC | #1
Em Thu, Oct 08, 2020 at 04:39:56PM -0700, Andrii Nakryiko escreveu:
> From: Andrii Nakryiko <andriin@fb.com>
> 
> When doing BTF encoding/deduping, DWARF CUs are never used after BTF encoding
> is done, so there is no point in wasting memory and keeping them in memory. So
> discard them immediately.

Right now, yes, but DW_TAG_partial_unit may require we keep them around.

I'm applying the patch since the common case, the kernel, is not yet
using that DWARF compression technique.

- Arnaldo
 
> Signed-off-by: Andrii Nakryiko <andriin@fb.com>
> ---
>  pahole.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/pahole.c b/pahole.c
> index 61522175519e..bd9b993777ee 100644
> --- a/pahole.c
> +++ b/pahole.c
> @@ -2384,7 +2384,7 @@ static enum load_steal_kind pahole_stealer(struct cu *cu,
>  			fprintf(stderr, "Encountered error while encoding BTF.\n");
>  			exit(1);
>  		}
> -		return LSK__KEEPIT;
> +		return LSK__DELETE;
>  	}
>  
>  	if (ctf_encode) {
> -- 
> 2.24.1
>
diff mbox series

Patch

diff --git a/pahole.c b/pahole.c
index 61522175519e..bd9b993777ee 100644
--- a/pahole.c
+++ b/pahole.c
@@ -2384,7 +2384,7 @@  static enum load_steal_kind pahole_stealer(struct cu *cu,
 			fprintf(stderr, "Encountered error while encoding BTF.\n");
 			exit(1);
 		}
-		return LSK__KEEPIT;
+		return LSK__DELETE;
 	}
 
 	if (ctf_encode) {