From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7F3EDC282CE for ; Mon, 11 Feb 2019 15:13:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4CEEB20844 for ; Mon, 11 Feb 2019 15:13:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549898032; bh=GKCQgwhlMzBWpXq4nyYCFwtUQdP5rhrAZRu7Ch4pGEk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=JzHOEZRkEzxtfH0C4mFZSZxGXhk05rsndrRiiHO+OlDQvoWuX4xdqb9K1PKAX0+Tf CAFcUpcPNNCItb5/0i5J+HgtfjY3eL8dhMnCXKKT/YWRcIC5pMl8SSC684NDJR9/3O oXTSEnoaa9yHW4kTDBwaDTb57Lj5KYeaLS5hNpng= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391240AbfBKPJJ (ORCPT ); Mon, 11 Feb 2019 10:09:09 -0500 Received: from mail.kernel.org ([198.145.29.99]:59028 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390967AbfBKPJI (ORCPT ); Mon, 11 Feb 2019 10:09:08 -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 C6CD0222B4; Mon, 11 Feb 2019 15:09:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549897748; bh=GKCQgwhlMzBWpXq4nyYCFwtUQdP5rhrAZRu7Ch4pGEk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IuGWD+gO9B0qHEXqNrMZjMBSBkRujN/iGikV88qANq5uMuwheF1z/ogyRqJ0xpI5N /DKWLpiWjSNgQv9r5X4X58ferX/J0u5HQ981P+QcjWRJI6+9m3a3cp7rIxyLY6l7z4 o5LfejyjKfWrN8HuYZC+eqAFtCD4ry6IL1eLBl6I= 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.9 102/137] fs/epoll: drop ovflist branch prediction Date: Mon, 11 Feb 2019 15:19:43 +0100 Message-Id: <20190211141821.526550479@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141811.964925535@linuxfoundation.org> References: <20190211141811.964925535@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: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org 4.9-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 3cbc30413add..a9c0bf8782f5 100644 --- a/fs/eventpoll.c +++ b/fs/eventpoll.c @@ -1040,7 +1040,7 @@ static int ep_poll_callback(wait_queue_t *wait, unsigned mode, int sync, void *k * 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