From: Jan Kara <jack@suse.cz>
To: Amir Goldstein <amir73il@gmail.com>
Cc: Jan Kara <jack@suse.cz>, linux-fsdevel <linux-fsdevel@vger.kernel.org>
Subject: Re: [PATCH 0/7] Performance improvement for fanotify merge
Date: Wed, 17 Feb 2021 12:25:39 +0100 [thread overview]
Message-ID: <20210217112539.GC14758@quack2.suse.cz> (raw)
In-Reply-To: <CAOQ4uxi7NdNQOpGResWEtRDPv+yGSTkMY99tVDVv2mkOW3g97w@mail.gmail.com>
On Wed 17-02-21 12:52:21, Amir Goldstein wrote:
> On Tue, Feb 16, 2021 at 6:02 PM Jan Kara <jack@suse.cz> 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@suse.com>
SUSE Labs, CR
next prev parent reply other threads:[~2021-02-17 11:31 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-02 16:20 [PATCH 0/7] Performance improvement for fanotify merge Amir Goldstein
2021-02-02 16:20 ` [PATCH 1/7] fsnotify: allow fsnotify_{peek,remove}_first_event with empty queue Amir Goldstein
2021-02-02 16:20 ` [PATCH 2/7] fsnotify: support hashed notification queue Amir Goldstein
2021-02-16 15:02 ` Jan Kara
2021-02-17 12:33 ` Amir Goldstein
2021-02-17 13:48 ` Jan Kara
2021-02-17 15:42 ` Amir Goldstein
2021-02-17 16:49 ` Jan Kara
2021-02-18 10:52 ` Amir Goldstein
2021-02-02 16:20 ` [PATCH 3/7] fsnotify: read events from hashed notification queue by order of insertion Amir Goldstein
2021-02-16 15:10 ` Jan Kara
2021-02-02 16:20 ` [PATCH 4/7] fanotify: enable hashed notification queue for FAN_CLASS_NOTIF groups Amir Goldstein
2021-02-02 16:20 ` [PATCH 5/7] fanotify: limit number of event merge attempts Amir Goldstein
2021-02-27 8:31 ` Amir Goldstein
2021-03-01 13:08 ` Jan Kara
2021-03-01 13:58 ` Amir Goldstein
2021-09-15 12:39 ` Amir Goldstein
2021-09-15 16:33 ` Jan Kara
2021-02-02 16:20 ` [PATCH 6/7] fanotify: mix event info into merge key hash Amir Goldstein
2021-02-16 15:39 ` Jan Kara
2021-02-17 10:13 ` Amir Goldstein
2021-02-18 10:46 ` Amir Goldstein
2021-02-18 11:11 ` Jan Kara
2021-02-18 12:17 ` Amir Goldstein
2021-02-02 16:20 ` [PATCH 7/7] fsnotify: print some debug stats on hashed queue overflow Amir Goldstein
2021-02-16 16:02 ` [PATCH 0/7] Performance improvement for fanotify merge Jan Kara
2021-02-17 10:52 ` Amir Goldstein
2021-02-17 11:25 ` Jan Kara [this message]
2021-02-18 10:56 ` Amir Goldstein
2021-02-18 11:15 ` Jan Kara
2021-02-18 12:35 ` Amir Goldstein
2021-02-19 10:15 ` Jan Kara
2021-02-19 10:21 ` Jan Kara
2021-02-19 13:38 ` Amir Goldstein
2021-02-21 12:53 ` Amir Goldstein
2021-02-22 9:29 ` Jan Kara
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210217112539.GC14758@quack2.suse.cz \
--to=jack@suse.cz \
--cc=amir73il@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).