lkml.org 
[lkml]   [2020]   [Apr]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [RFC] fs: Use slab constructor to initialize conn objects in fsnotify
On Thu, Apr 23, 2020 at 7:45 AM Joel Fernandes <joel@joelfernandes.org> wrote:
>
> On Thu, Apr 23, 2020 at 12:40:50AM -0400, Joel Fernandes (Google) wrote:
> > While reading the famous slab paper [1], I noticed that the conn->lock
> > spinlock and conn->list hlist in fsnotify code is being initialized
> > during every object allocation. This seems a good fit for the
> > constructor within the slab to take advantage of the slab design. Move
> > the initializtion to that.
> >
> > spin_lock_init(&conn->lock);
> > INIT_HLIST_HEAD(&conn->list);
> >
> > [1] https://pdfs.semanticscholar.org/1acc/3a14da69dd240f2fbc11d00e09610263bdbd.pdf
> >
>
> The commit message could be better. Just to clarify, doing it this way is
> more efficient because the object will only have its spinlock init and hlist
> init happen during object construction, not object allocation.
>

This change may be correct, but completely unjustified IMO.
conn objects are very rarely allocated, from user syscall path only.
I see no reason to micro optimize this.

Perhaps there is another justification to do this, but not efficiency.

Thanks,
Amir.

\
 
 \ /
  Last update: 2020-04-23 07:25    [W:0.048 / U:0.320 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site