Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2658049imj; Mon, 11 Feb 2019 06:35:30 -0800 (PST) X-Google-Smtp-Source: AHgI3IaPcHKmBJeF4u9RtcIxwLbGN58rVR8nOh3dXt89iw4315GnNXRtgB+thnt9MVIEGzoX1Kcg X-Received: by 2002:a63:184a:: with SMTP id 10mr33047124pgy.81.1549895730798; Mon, 11 Feb 2019 06:35:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549895730; cv=none; d=google.com; s=arc-20160816; b=emMFnqYX4HR9WzFRkTHbUN3/28GzhHDC2/x4RV/AIPVtsBAEbnVi6Mq6rZz9KXrIqe +kk9hWkcAm4PaJsCRsaATVnvdowk52MzHcV/yurCYp2ul4v3ILUMj/jkoS977Dci5FZH bQYxAgOfYSnaHnH/cCVGnJXlpA0PA5q/E7rZ+FHnRaEKZjA9yejdmoV8JejqiBbyzRku sV46R7HehYMK0BeSBdMaS5KaBWNKlJgdUvQcvYRIDQtAUZTuA1wT9n2qsmDdEoMsU2vE zcC1PR4EfeH7UXO7SLFFWRDT9H9MBJiLCpyXi0QeIXnqhOF/ifDct/JJMXZogCxbAXNA 24yw== 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=UHoF6rweOxhaV16wilb00IDlCs5ae1ePT5BZxURNmIc=; b=O/EbOqoSrtxe86EnQmgV+jzKLPdmrSkTFzu+IrNeeQ+C7KasXCjOiaFUMnpS7EhqNz 2pOx32g/QIrhqi9wBrOF2HKKxIzM6Lr+xp1nBPz3kLv9dQE3VtgFMuUlruRJIqL0WrMR cA7x0HJvhj64fuwgrRqz9WKxGbaXagByL7C4QVbtQ0VhMlmiCuh4zCp1LW9Q1EBjvP+i 3Px0TwdnCVjnJpyATOp0F5VAHqhu2DHh5fasSLdByB9mgDsg0t7O2MMrE4B6bxDC/OxK uUDOiRHFPvwWC7QoOK8G0TLQV9/DdkHXxP/PXH6iAN+aKzc3OzNr2k8EJYUOTdJfP+JD JhOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=mnwRv3fM; 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 j10si8886099pgp.282.2019.02.11.06.35.14; Mon, 11 Feb 2019 06:35:30 -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=mnwRv3fM; 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 S1730896AbfBKOel (ORCPT + 99 others); Mon, 11 Feb 2019 09:34:41 -0500 Received: from mail.kernel.org ([198.145.29.99]:43014 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730886AbfBKOeh (ORCPT ); Mon, 11 Feb 2019 09:34:37 -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 B52C02081B; Mon, 11 Feb 2019 14:34:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549895677; bh=6NBiniT+8B0P35Z9c181AGqMyEophE6+yb/JNex69IU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mnwRv3fMllSWvmGVF8FkfmEnXqdve12OXeUB+x4H/x8H4PT1VgZJM1nan7+Ngtz3U vhwlYLkLxVk4IY3dlPlVe7PrC5WSlwyPnKcI3aVsYHJ9af/C5HiccKO9MmG+ASnAkp XMY8zUMVsM/sKOx1nryKiFJEy5dfc9ZREA11f4CY= 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.20 286/352] fs/epoll: drop ovflist branch prediction Date: Mon, 11 Feb 2019 15:18:33 +0100 Message-Id: <20190211141905.117417980@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141846.543045703@linuxfoundation.org> References: <20190211141846.543045703@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.20-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 42bbe6824b4b..58f48ea0db23 100644 --- a/fs/eventpoll.c +++ b/fs/eventpoll.c @@ -1154,7 +1154,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