lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed,  7 Nov 2018 21:10:03 -0800
From:   Davidlohr Bueso <dave@...olabs.net>
To:     akpm@...ux-foundation.org
Cc:     jbaron@...mai.com, viro@...iv.linux.org.uk, dave@...olabs.net,
        linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
        Davidlohr Bueso <dbueso@...e.de>
Subject: [PATCH 3/6] fs/epoll: drop ovflist branch prediction

The ep->ovflist is a secondary ready-list to temporarily store
events that might occur when doing sproc without holding the
ep->wq.lock. This accounts for every time we check for ready
events and also send events back to userspace; both callbacks,
particularly the later because of copy_to_user, can account
for a non-trivial time.

As such, the unlikely() check to see if the pointer is being
used, seems both misleading and sub-optimal. In fact, we go
to an awful lot of trouble to sync both lists, and populating
the ovflist is far from an uncommon scenario.

For example, profiling a concurrent epoll_wait(2) benchmark,
with CONFIG_PROFILE_ANNOTATED_BRANCHES shows that for a two threads
a 33% incorrect rate was seen; and when incrementally increasing
the number of epoll instances (which is used, for example for
multiple queuing load balancing models), up to a 90% incorrect
rate was seen.

Similarly, by deleting the prediction, 3% throughput boost was
seen across incremental threads.

Signed-off-by: Davidlohr Bueso <dbueso@...e.de>
---
 fs/eventpoll.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index 101d46b81f64..347da3f4f5d3 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -1153,7 +1153,7 @@ static int ep_poll_callback(wait_queue_entry_t *wait, unsigned mode, int sync, v
 	 * semantics). All the events that happen during that period of time are
 	 * chained in ep->ovflist and requeued later on.
 	 */
-	if (unlikely(ep->ovflist != EP_UNACTIVE_PTR)) {
+	if (ep->ovflist != EP_UNACTIVE_PTR) {
 		if (epi->next == EP_UNACTIVE_PTR) {
 			epi->next = ep->ovflist;
 			ep->ovflist = epi;
-- 
2.16.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ