Re: [PATCH 0/7] Performance improvement for fanotify merge

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed 17-02-21 12:52:21, Amir Goldstein wrote:
> On Tue, Feb 16, 2021 at 6:02 PM Jan Kara <jack@xxxxxxx> wrote:
> >
> > Hi Amir!
> >
> > Looking at the patches I've got one idea:
> >
> > Currently you have fsnotify_event like:
> >
> > struct fsnotify_event {
> >         struct list_head list;
> >         unsigned int key;
> >         unsigned int next_bucket;
> > };
> >
> > And 'list' is used for hashed queue list, next_bucket is used to simulate
> > single queue out of all the individual lists. The option I'm considering
> > is:
> >
> > struct fsnotify_event {
> >         struct list_head list;
> >         struct fsnotify_event *hash_next;
> >         unsigned int key;
> > };
> >
> > So 'list' would stay to be used for the single queue of events like it was
> > before your patches. 'hash_next' would be used for list of events in the
> > hash chain. The advantage of this scheme would be somewhat more obvious
> > handling,
> 
> I can agree to that.
> 
> > also we can handle removal of permission events (they won't be
> > hashed so there's no risk of breaking hash-chain in the middle, removal
> > from global queue is easy as currently).
> 
> Ok. but I do not really see a value in hashing non-permission events
> for high priority groups, so this is not a strong argument.

The reason why I thought it is somewhat beneficial is that someone might be
using higher priority fanotify group just for watching non-permission
events because so far the group priority makes little difference. And
conceptually it isn't obvious (from userspace POV) why higher priority
groups should be merging events less efficiently...

> > The disadvantage is increase of
> > event size by one pointer on 64-bit but I think we can live with that. What
> > do you think?
> 
> Given the round size of fixes size events in v5.10, that would be a shame:
> 
> ls -l /sys/kernel/slab/*notify*event
> lrwxrwxrwx 1 root root 0 Feb 17 12:23
> /sys/kernel/slab/fanotify_fid_event -> :0000064
> lrwxrwxrwx 1 root root 0 Feb 17 12:23
> /sys/kernel/slab/fanotify_path_event -> :0000056
> lrwxrwxrwx 1 root root 0 Feb 17 12:23
> /sys/kernel/slab/fanotify_perm_event -> :0000064
> 
> Counter proposal:
> 
> struct fsnotify_event {
>         struct list_head list;
>         struct fsnotify_event *hash_next;
>         unsigned int key;
>         u32 mask;
> };

Even better!

> It is quite strange that mask is a member of struct fanotify_event and
> struct inotify_event_info to begin with.

Because they were moved there in the past to improve struct packing ;)

> Moving the mask member to struct fsnotify_event like that is not going
> to change the resulting inotify/fanotify event size.
> 
> We can actually squeeze fanotify_event_type into 2 low bits of pid
> pointer, and reduce the size of all fanotify events by one pointer,
> because FANOTIFY_EVENT_TYPE_OVERFLOW is nice to have.
> The overflow event can use FANOTIFY_EVENT_TYPE_PATH with a
> NULL path values (as early versions of the patch did).
> 
> This is not worth doing with current round event size, IMO.

I agree. Not worth it at this point.

								Honza
-- 
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux