From: Roman Penyaev <rpenyaev@suse.de>
To: unlisted-recipients:; (no To-header on input)
Cc: Roman Penyaev <rpenyaev@suse.de>,
Davidlohr Bueso <dbueso@suse.de>, Jason Baron <jbaron@akamai.com>,
Al Viro <viro@zeniv.linux.org.uk>,
"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
Linus Torvalds <torvalds@linux-foundation.org>,
Andrew Morton <akpm@linux-foundation.org>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2 0/4] use rwlock in order to reduce ep_poll_callback() contention
Date: Thu, 3 Jan 2019 16:01:00 +0100 [thread overview]
Message-ID: <20190103150104.17128-1-rpenyaev@suse.de> (raw)
The last patch targets the contention problem in ep_poll_callback(), which
can be very well reproduced by generating events (write to pipe or eventfd)
from many threads, while consumer thread does polling.
The following are some microbenchmark results based on the test [1] which
starts threads which generate N events each. The test ends when all events
are successfully fetched by the poller thread:
spinlock
========
threads events/ms run-time ms
8 6402 12495
16 7045 22709
32 7395 43268
rwlock + xchg
=============
threads events/ms run-time ms
8 10038 7969
16 12178 13138
32 13223 24199
According to the results bandwidth of delivered events is significantly
increased, thus execution time is reduced.
This series is based on linux-next/akpm.
v2:
o I was wrong saying that ep_poll_callback() can't be called
concurrently for the same epi: several wait queues can be
attached to the single epoll item, thus several event sources
can signal in parallel. To cover this case lockless element
addition has to detect that the same @epi is not yet in the
list. This is done by extra cmpxchg() operation.
o unify awaking of wakeup source calling ep_pm_stay_awake_rcu(epi)
in all the cases from ep_poll_callback() path.
o more explicit comments
[1] https://github.com/rouming/test-tools/blob/master/stress-epoll.c
Roman Penyaev (4):
epoll: make sure all elements in ready list are in FIFO order
epoll: loosen irq safety in ep_poll_callback()
epoll: unify awaking of wakeup source on ep_poll_callback() path
epoll: use rwlock in order to reduce ep_poll_callback() contention
fs/eventpoll.c | 178 ++++++++++++++++++++++++++++++++++++-------------
1 file changed, 133 insertions(+), 45 deletions(-)
Signed-off-by: Roman Penyaev <rpenyaev@suse.de>
Cc: Davidlohr Bueso <dbueso@suse.de>
Cc: Jason Baron <jbaron@akamai.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-fsdevel@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
--
2.19.1
next reply other threads:[~2019-01-03 15:01 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-03 15:01 Roman Penyaev [this message]
2019-01-03 15:01 ` [PATCH v2 1/4] epoll: make sure all elements in ready list are in FIFO order Roman Penyaev
2019-01-03 15:01 ` [PATCH v2 2/4] epoll: loosen irq safety in ep_poll_callback() Roman Penyaev
2019-01-03 15:01 ` [PATCH v2 3/4] epoll: unify awaking of wakeup source on ep_poll_callback() path Roman Penyaev
2019-01-03 15:01 ` [PATCH v2 4/4] epoll: use rwlock in order to reduce ep_poll_callback() contention Roman Penyaev
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=20190103150104.17128-1-rpenyaev@suse.de \
--to=rpenyaev@suse.de \
--cc=akpm@linux-foundation.org \
--cc=dbueso@suse.de \
--cc=jbaron@akamai.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=paulmck@linux.vnet.ibm.com \
--cc=torvalds@linux-foundation.org \
--cc=viro@zeniv.linux.org.uk \
/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®