[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAM9d7cjcuz1ifeHUC=kqNsZVHn_jUsM-XWQRoXD1MVzRcoZ-kQ@mail.gmail.com>
Date: Tue, 12 Dec 2023 17:33:49 -0800
From: Namhyung Kim <namhyung@...nel.org>
To: Ian Rogers <irogers@...gle.com>
Cc: Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...nel.org>,
Adrian Hunter <adrian.hunter@...el.com>,
"Masami Hiramatsu (Google)" <mhiramat@...nel.org>,
Thomas Richter <tmricht@...ux.ibm.com>,
Quentin Monnet <quentin@...valent.com>,
Fangrui Song <maskray@...gle.com>,
Kan Liang <kan.liang@...ux.intel.com>,
Yanteng Si <siyanteng@...ngson.cn>,
K Prateek Nayak <kprateek.nayak@....com>,
Artem Savkov <asavkov@...hat.com>,
James Clark <james.clark@....com>,
Ravi Bangoria <ravi.bangoria@....com>,
linux-kernel@...r.kernel.org, linux-perf-users@...r.kernel.org
Subject: Re: [PATCH v1 2/6] tools lib api: Add io_dir an allocation free
readdir alternative
On Mon, Dec 11, 2023 at 3:54 PM Ian Rogers <irogers@...gle.com> wrote:
>
> On Mon, Dec 11, 2023 at 3:25 PM Namhyung Kim <namhyung@...nel.org> wrote:
> >
> > On Wed, Dec 6, 2023 at 9:04 PM Ian Rogers <irogers@...gle.com> wrote:
> > >
> > > glibc's opendir allocates a minimum of 32kb, when called recursively
> > > for a directory tree the memory consumption can add up - nearly 300kb
> > > during perf start-up when processing modules. Add a stack allocated
> > > variant of readdir sized a little more than 1kb.
> > >
> > > As getdents64 may be missing from libc, add support using syscall.
> >
> > Unfortunately my alpine build has:
> >
> > In file included from util/machine.c:2:
> > /build/libapi/include/api/io_dir.h:17:23: error: conflicting types for
> > 'getdents'; have 'ssize_t(int, void *, size_t)' {aka 'long int(int,
> > void *, long unsigned int)'}
> > 17 | static inline ssize_t getdents64(int fd, void *dirp, size_t count)
> > | ^~~~~~~~~~
> > /usr/include/dirent.h:52:5: note: previous declaration of 'getdents'
> > with type 'int(int, struct dirent *, size_t)' {aka 'int(int, struct
> > dirent *, long unsigned int)'}
> > 52 | int getdents(int, struct dirent *, size_t);
> > | ^~~~~~~~
>
> Presumably there is a #define getdents64 getdents .. Could we stop
> caring about this version of Alpine linux?
Right, there's a #define:
https://git.musl-libc.org/cgit/musl/tree/include/dirent.h#n68
But I'm not sure ignoring Alpine linux is a good idea.
Maybe we can add a #undef right before?
Thanks,
Namhyung
Powered by blists - more mailing lists