linux/fs/notify
Dave Hansen 7c49b86164 fs/notify: optimize inotify/fsnotify code for unwatched files
I have a _tiny_ microbenchmark that sits in a loop and writes single
bytes to a file.  Writing one byte to a tmpfs file is around 2x slower
than reading one byte from a file, which is a _bit_ more than I expecte.
This is a dumb benchmark, but I think it's hard to deny that write() is
a hot path and we should avoid unnecessary overhead there.

I did a 'perf record' of 30-second samples of read and write.  The top
item in a diffprofile is srcu_read_lock() from fsnotify().  There are
active inotify fd's from systemd, but nothing is actually listening to
the file or its part of the filesystem.

I *think* we can avoid taking the srcu_read_lock() for the common case
where there are no actual marks on the file.  This means that there will
both be nothing to notify for *and* implies that there is no need for
clearing the ignore mask.

This patch gave a 13.1% speedup in writes/second on my test, which is an
improvement from the 10.8% that I saw with the last version.

Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Reviewed-by: Jan Kara <jack@suse.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Eric Paris <eparis@redhat.com>
Cc: John McCutchan <john@johnmccutchan.com>
Cc: Robert Love <rlove@rlove.org>
Cc: Andi Kleen <ak@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2015-09-04 16:54:41 -07:00
..
dnotify fsnotify: unify inode and mount marks handling 2014-12-13 12:42:53 -08:00
fanotify fanotify: fix event filtering with FAN_ONDIR set 2015-03-12 18:46:08 -07:00
inotify fs/notify: don't use module_init for non-modular inotify_user code 2015-06-16 14:12:34 -04:00
fdinfo.c fsnotify: unify inode and mount marks handling 2014-12-13 12:42:53 -08:00
fdinfo.h fs: Convert show_fdinfo functions to void 2014-11-05 14:13:23 -05:00
fsnotify.c fs/notify: optimize inotify/fsnotify code for unwatched files 2015-09-04 16:54:41 -07:00
fsnotify.h fsnotify: unify inode and mount marks handling 2014-12-13 12:42:53 -08:00
group.c fs/notify/group.c: make fsnotify_final_destroy_group() static 2014-10-09 22:25:45 -04:00
inode_mark.c fsnotify: unify inode and mount marks handling 2014-12-13 12:42:53 -08:00
Kconfig rcu: Make SRCU optional by using CONFIG_SRCU 2015-01-06 11:04:29 -08:00
Makefile fs, notify: add procfs fdinfo helper 2012-12-17 17:15:28 -08:00
mark.c fsnotify: fix oops in fsnotify_clear_marks_by_group_flags() 2015-08-07 04:39:41 +03:00
notification.c fanotify: fix double free of pending permission events 2014-08-06 18:01:12 -07:00
vfsmount_mark.c fsnotify: unify inode and mount marks handling 2014-12-13 12:42:53 -08:00