Re: [PATCH 2/9] perf/core: Add PERF_SAMPLE_CGROUP feature

From: Tejun Heo
Date: Mon Oct 07 2019 - 10:16:57 EST


Hello,

On Wed, Oct 02, 2019 at 03:28:00PM +0900, Namhyung Kim wrote:
> On Sat, Sep 21, 2019 at 6:04 AM Tejun Heo <tj@xxxxxxxxxx> wrote:
> >
> > On Fri, Sep 20, 2019 at 05:47:45PM +0900, Namhyung Kim wrote:
> > > Thanks for the sharing information! For 32-bit, while the ino itself is not
> > > monotonic, gen << 32 + ino is monotonic right? I think we can use the
> >
> > It's not. gen gets incremented on every allocation, so it has not
> > high but still realistic chance of collisions.
>
> In __kernfs_new_node(), gen gets increased only if idr_alloc_cyclic()
> returns lower than the cursor... I'm not sure you talked about it.

Ah, I forgot that it's using cyclic idr, so yeah, it's not as bad in
terms of recycling although cyclic allocation on idr is pretty
inefficient. I still think it'd be better to switch to rbtree and so
that 64bit can simply use monotonically increasing numbers but that
definitely isn't a must and we can juse continue with the current
allocation method.

Thanks.

--
tejun