mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jes Sorensen <jes.sorensen@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: john@johnmccutchan.com, rlove@rlove.org, eparis@parisplace.org,
	josef@toxicpanda.com, kernel-team@fb.com,
	Jes Sorensen <jsorensen@fb.com>
Subject: [PATCH 0/5] inofify: Reduce lock contention on read()
Date: Fri, 24 Mar 2017 17:36:33 -0400	[thread overview]
Message-ID: <20170324213638.9114-1-jsorensen@fb.com> (raw)

Hi,

Running inotify on a very large number hierachy of directories and
files can result in major lock contention between the producer and
consumer of events.

The current code takes the spinlock when pulling each event off the
queue, which isn't overly idea. This patchset reduces the lock
contention by splicing off the event queue while processing reads and
putting the leftover events back on the queue once the read buffer is
full. In order to ensure ordering when reading events, a mutex is
added to read().

While this should reduce the number of locks taken on read when
reading in bulk, it does increase the overhead for the case where the
users tries to read one event at a time.

Last, the first patch of the series adds the missing mutex_destoy()
for mark_mutex.

Thoughts?
Jes

Jes Sorensen (5):
  notify: Call mutex_destroy() before freeing mutex memory
  inotify: Use mutex to prevent threaded clients reading events out of
    order
  notify: Split up some fsnotify functions
  inotify: switch get_one_event() to use fsnotify_list_*() helpers
  inotify: Avoid taking spinlock for each event processed in read()

 fs/notify/group.c                    |  1 +
 fs/notify/inotify/inotify_fsnotify.c |  1 +
 fs/notify/inotify/inotify_user.c     | 42 ++++++++++++++++++++++++++++--------
 fs/notify/notification.c             | 38 ++++++++++++++++++++++++++------
 include/linux/fsnotify_backend.h     |  7 ++++++
 5 files changed, 73 insertions(+), 16 deletions(-)

-- 
2.9.3

             reply	other threads:[~2017-03-24 21:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-24 21:36 Jes Sorensen [this message]
2017-03-24 21:36 ` [PATCH 1/5] notify: Call mutex_destroy() before freeing mutex memory Jes Sorensen
2017-03-24 21:36 ` [PATCH 2/5] inotify: Use mutex to prevent threaded clients reading events out of order Jes Sorensen
2017-03-24 21:36 ` [PATCH 3/5] notify: Split up some fsnotify functions Jes Sorensen
2017-03-24 21:36 ` [PATCH 4/5] inotify: switch get_one_event() to use fsnotify_list_*() helpers Jes Sorensen
2017-03-24 21:36 ` [PATCH 5/5] inotify: Avoid taking spinlock for each event processed in read() Jes Sorensen

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=20170324213638.9114-1-jsorensen@fb.com \
    --to=jes.sorensen@gmail.com \
    --cc=eparis@parisplace.org \
    --cc=john@johnmccutchan.com \
    --cc=josef@toxicpanda.com \
    --cc=jsorensen@fb.com \
    --cc=kernel-team@fb.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rlove@rlove.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

all inboxes | Powered by JetHome®