Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp79979imu; Wed, 7 Nov 2018 21:12:18 -0800 (PST) X-Google-Smtp-Source: AJdET5fvWUFBDqCyRlN+ciyYOlge6vDwivXRSZ7eQMI5PCsEyOxR3EDB08t3PJzFyXgWPZ6ZYBvG X-Received: by 2002:a17:902:8689:: with SMTP id g9-v6mr3141463plo.44.1541653938084; Wed, 07 Nov 2018 21:12:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541653938; cv=none; d=google.com; s=arc-20160816; b=wQp7rpt5hMiPLk724DyJBiQuYupCkPdBP5cKuoymHJbqXYnu4UP/vwpTna9/tuvaxS DhyZqSQWajosABvIiSMUdoyk5u3mhtmS599qNjkU0dF+QRUs3a0TQNwTzpRXBlP3+lng p9ISOL41gaYMUodaYBFGLcY3NAS3a4DKwEX11/QZcvdM4UzDNwVPWw6p3KJzcTqsK4h4 c6l858+1PodkwEBYYYRSS2bqC99mZWs/aR99joezNIpyz0/h/5pA95hxpf/4RP113Vol Uqq2OEv1qyfjeOBPqPaU7loWETV1t++b8xawdke6rUK1OEOhja7D/3RdJpq+bofOdrLc ucDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=T93+fewNJ9dQeBniWtndrGBtuU+Awzntqcxa2l16EBw=; b=ZjWEaKNn+3Utos3pno8SSUMvJ6uHbnNvXUg7yh5z4d2hN1dr9Q4V4/QLq4D/RRcv3h Ua4nhCPbkZfm89qhOOKOsdfAxzRTInb0Q4VBQqHRu5RwXqsnKBNWiPnGiR1aN3AttOuE BfRvqpFReZh1r43t1g/wLa3v8JcZc60lrmK76eYijmKEpk3VayDpws4qUCfN/KYBXFal FE3S8PR5EDqHMBsw7WBY++G0QToi5Uv/BOb3zHBUd3WhjkMIt74wuRklheF8FydnjQpC hZkoKGAXFXI+DzL4TDtIw0BfGo2Uwi4r7JWexxhFZU/UanT71IDzFvZ19U72WeNt5UVI 7BUA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 1-v6si3488599pls.0.2018.11.07.21.11.26; Wed, 07 Nov 2018 21:12:18 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728980AbeKHOoI (ORCPT + 99 others); Thu, 8 Nov 2018 09:44:08 -0500 Received: from smtp2.provo.novell.com ([137.65.250.81]:52650 "EHLO smtp2.provo.novell.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726145AbeKHOoH (ORCPT ); Thu, 8 Nov 2018 09:44:07 -0500 Received: from linux-r8p5.suse.de (prv-ext-foundry1int.gns.novell.com [137.65.251.240]) by smtp2.provo.novell.com with ESMTP (TLS encrypted); Wed, 07 Nov 2018 22:10:19 -0700 From: Davidlohr Bueso To: akpm@linux-foundation.org Cc: jbaron@akamai.com, viro@zeniv.linux.org.uk, dave@stgolabs.net, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Davidlohr Bueso Subject: [PATCH 3/6] fs/epoll: drop ovflist branch prediction Date: Wed, 7 Nov 2018 21:10:03 -0800 Message-Id: <20181108051006.18751-4-dave@stgolabs.net> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20181108051006.18751-1-dave@stgolabs.net> References: <20181108051006.18751-1-dave@stgolabs.net> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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