Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2688058imj; Mon, 11 Feb 2019 07:03:21 -0800 (PST) X-Google-Smtp-Source: AHgI3IZe1aO9xeqFEfdj2aKre7IqhXRNPqc63hNiucAUrNGpmdMTxy+K40TBwia4jy13N6dvm4Zk X-Received: by 2002:a63:c042:: with SMTP id z2mr254953pgi.307.1549897401451; Mon, 11 Feb 2019 07:03:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549897401; cv=none; d=google.com; s=arc-20160816; b=Dy4df8OnNVCyNbjuLz59u7XK6qaEJjRMOsyGtxmxFgaAWmqXwPmAE9JZAnlKENfAnZ vepsVJd6U2fMNzFHk3REQd98O6PXltpB0VmJOLtOJzhFR4BD+ZR3UATeh8qU2F0iqDKe FNvvGB/LvhG/dYZ/4hFb8Xr7kzutR0zWVP2oyey3oCaQKhMiZ3874iF7D8CMeV3nwyAQ DIMzYonDf5z3/on+pg+lfNdKbTUr9lfjGcpJ6EkZ8WRP0CiNx2hwD4gTp+Pl/gWitTyn EZuu7aBNEpqg89ra+gnajX0SnceZ7B1VmrFffOqsxRq5C8NDdDOXscbcPY7+n6babpLr VTsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=P6qfTz0aLFm6O3x845a+BDBkoWTf4VaWXZDgwWmhLk0=; b=II+ou98xNBT1sY52wGV67XhfNWDW9A42K/O9ceo2a+X/1H2HdeHgRw2COMIEgJJq1u sktiYKesQl2agA4NJf2Y5es9MnVlNbszMs3ak+yAj1JsOGSg+asCU3IT7JUwT+mFZw5K 6HTYczmD0RHTputs87p/yYa4k8BYpR+le0mVbrjUyvNZGabLQwG3dN4s0MuwSBWqyhZd XExN1kMNvAPfP7BalBHtNVGekKbeilMJ+BeGhkqAP85+g8g6STVwhnavBqDz+PRAJF+k +X9y+iyox9rdTuMt4LwN8b9tono3rlFnMjI3e60jav4GUfnlHCvcciWfPGrXl9QRWlvH Jp0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=FDlS3+an; 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 e4si8956557pgs.492.2019.02.11.07.03.02; Mon, 11 Feb 2019 07:03:21 -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; dkim=pass header.i=@kernel.org header.s=default header.b=FDlS3+an; 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 S2390308AbfBKPB5 (ORCPT + 99 others); Mon, 11 Feb 2019 10:01:57 -0500 Received: from mail.kernel.org ([198.145.29.99]:50094 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389510AbfBKPB4 (ORCPT ); Mon, 11 Feb 2019 10:01:56 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7EDD5222A6; Mon, 11 Feb 2019 15:01:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549897316; bh=yByH9VmJcOKeCGujkEECfD6dSLRDhh+lDRv1ldp5P94=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FDlS3+anCU0/9aJvPzE6CW0gx33khj9fHMjCnKToBIu6WvlYZge++iXodAkmFxxrL +KySi2GUr5INaEUhuBR2B9qZ+Uz1Uw7jmKdqqCdfniPFwGYKqwQfpKwEVUFDg2356q m2fsU+iFd/aadrLdWGJ1cQHBgw8WzO6naJqnmXeE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Davidlohr Bueso , Andrew Morton , Al Viro , Jason Baron , Linus Torvalds , Sasha Levin Subject: [PATCH 4.14 162/205] fs/epoll: drop ovflist branch prediction Date: Mon, 11 Feb 2019 15:19:20 +0100 Message-Id: <20190211141838.951381692@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141827.214852402@linuxfoundation.org> References: <20190211141827.214852402@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit 76699a67f3041ff4c7af6d6ee9be2bfbf1ffb671 ] 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 latter 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. Link: http://lkml.kernel.org/r/20181108051006.18751-4-dave@stgolabs.net Signed-off-by: Davidlohr Bueso Reviewed-by: Andrew Morton Cc: Al Viro Cc: Jason Baron Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin --- fs/eventpoll.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/eventpoll.c b/fs/eventpoll.c index 2fabd19cdeea..c291bf61afb9 100644 --- a/fs/eventpoll.c +++ b/fs/eventpoll.c @@ -1167,7 +1167,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.19.1