On Mon, Oct 14, 2024 at 11:31:42AM +0100, Alan Maguire wrote: > This reduces peak memory utilization during BTF vmlinux encoding, > replacing ELF section-sized malloc()s with mmap()s. > > For -j1 peak memory resident set size drops from > > Maximum resident set size (kbytes): 1069220 > > ...to: > > Maximum resident set size (kbytes): 701888 > > ...with this patch. > > For -j8, peak memory resident set size drops from > > Maximum resident set size (kbytes): 1121172 > > ...to: > > Maximum resident set size (kbytes): 963516 Thanks, applied to perf-tools-next, - Arnaldo > Signed-off-by: Alan Maguire <alan.maguire@xxxxxxxxxx> > --- > btf_encoder.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/btf_encoder.c b/btf_encoder.c > index 5954238..9599faf 100644 > --- a/btf_encoder.c > +++ b/btf_encoder.c > @@ -1879,7 +1879,7 @@ static int btf_encoder__tag_kfuncs(struct btf_encoder *encoder) > goto out; > } > > - elf = elf_begin(fd, ELF_C_READ, NULL); > + elf = elf_begin(fd, ELF_C_READ_MMAP, NULL); > if (elf == NULL) { > elf_error("Cannot update ELF file"); > goto out; > -- > 2.43.5