[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y/8J7pkJ8g1uEQcq@krava>
Date: Wed, 1 Mar 2023 09:16:46 +0100
From: Jiri Olsa <olsajiri@...il.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: Alexei Starovoitov <ast@...nel.org>,
Andrii Nakryiko <andrii@...nel.org>,
Hao Luo <haoluo@...gle.com>,
Alexander Viro <viro@...iv.linux.org.uk>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Matthew Wilcox <willy@...radead.org>, bpf@...r.kernel.org,
linux-mm@...ck.org, linux-kernel@...r.kernel.org,
linux-fsdevel@...r.kernel.org, linux-perf-users@...r.kernel.org,
Martin KaFai Lau <kafai@...com>,
Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
John Fastabend <john.fastabend@...il.com>,
KP Singh <kpsingh@...omium.org>,
Stanislav Fomichev <sdf@...gle.com>,
Daniel Borkmann <daniel@...earbox.net>,
Namhyung Kim <namhyung@...il.com>
Subject: Re: [PATCH RFC v2 bpf-next 1/9] mm: Store build id in inode object
On Tue, Feb 28, 2023 at 11:13:10AM -0800, Andrew Morton wrote:
> On Tue, 28 Feb 2023 10:31:58 +0100 Jiri Olsa <jolsa@...nel.org> wrote:
>
> > Storing build id in file's inode object for elf executable with build
> > id defined. The build id is stored when file is mmaped.
> >
> > This is enabled with new config option CONFIG_INODE_BUILD_ID.
> >
> > The build id is valid only when the file with given inode is mmap-ed.
> >
> > We store either the build id itself or the error we hit during
> > the retrieval.
> >
> > ...
> >
> > --- a/include/linux/fs.h
> > +++ b/include/linux/fs.h
> > @@ -699,6 +700,12 @@ struct inode {
> > struct fsverity_info *i_verity_info;
> > #endif
> >
> > +#ifdef CONFIG_INODE_BUILD_ID
> > + /* Initialized and valid for executable elf files when mmap-ed. */
> > + struct build_id *i_build_id;
> > + spinlock_t i_build_id_lock;
> > +#endif
> > +
>
> Remember we can have squillions of inodes in memory. So that's one
> costly spinlock!
>
> AFAICT this lock could be removed if mmap_region() were to use an
> atomic exchange on inode->i_build_id?
right, that should work I'll check
>
> If not, can we use an existing lock? i_lock would be appropriate
> (don't forget to update its comment).
ok
>
> Also, the code in mmap_region() runs build_id_free() inside the locked
> region, which seems unnecessary.
>
ok, if the atomic exchange is doable, it'll take care of this
thanks,
jirka
Powered by blists - more mailing lists