Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp79980imu; Wed, 7 Nov 2018 21:12:18 -0800 (PST) X-Google-Smtp-Source: AJdET5fPwpui9G8nHkwcwyyy0+1dLKmlOV7z9b1ehfoRoRxtO/VcZoE1FS4hCAbjgD95EmW4+xLS X-Received: by 2002:a17:902:66e5:: with SMTP id e92-v6mr3108343plk.92.1541653938062; 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=wsB1ryUVW+9VHklYG5y5w3Ll0Qp4ZiTJl5Kc8dIAu+aRRslqBmeEuH/HLDU+QM7AMT 84mDn0EdDNYmyVugYU2tWOynXhxuP+zNRmcpClrf173eWq94z/mFXKHqH7TLTkLvHdL4 o8gAwUJlJ1ZnFDFK033PF9kwnfdQcA/2hmLrfMZZ10uW7mllLD2YFCCcafInhXx9hS6I Ox7s0uhJgwyyuY7eMVRibxW1Gp340jyCD0gAtMazvsmIA7Ld2ryPekiyg2FbiqwUsk9i lt1cFifnqIpgTl/Iy+8ewbqS6Z1mBB8ARcCap22a2NTFL/NIlD4TgL2ouj9FbmRpa3fs eZ0Q== 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=J9zr8HcYqNB86kg8VRrWiEH+5uX7EiyeQOYpfa+1Vno=; b=Dftc5ISiQJfsDv8tGzm9fnYk4+XcWNKBpOrppZC4oIuOucOMOa8kdXU5jPqPlVKtBb T4/EwgOM4WFTDxZe3G8cEPUTGpMPHDO1b43efv7HvypnydUyxJ+M/QwO4z8li+1IRuqi mBoI4MuyN1ppYV56z7H5TeRCJffpVUc2cHfWryaz6l9uUEuwW5hSB5z4bPkyAg2ZUcmE y96RuGofE8w1eZFpdMogXvUrAc3z8fEOZblYkcrJ8Z8tRMPykX1ZI72SwMWkcjsMlLDx xggXWMSWc+t3WKnEhlEw1iN3axyD5pnkrZNcuL8OhsT1ZMlpWL5Y5Jc/Wou/14usjKo2 6KGA== 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 d23si2620006pgj.558.2018.11.07.21.11.25; 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 S1729036AbeKHOoM (ORCPT + 99 others); Thu, 8 Nov 2018 09:44:12 -0500 Received: from smtp2.provo.novell.com ([137.65.250.81]:45488 "EHLO smtp2.provo.novell.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726145AbeKHOoJ (ORCPT ); Thu, 8 Nov 2018 09:44:09 -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:21 -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 Subject: [PATCH 6/6] fs/epoll: avoid barrier after an epoll_wait(2) timeout Date: Wed, 7 Nov 2018 21:10:06 -0800 Message-Id: <20181108051006.18751-7-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 Upon timeout, we can just exit out of the loop, without the cost of the changing the task's state smp_store_mb call. Just exit out of the loop and be done - setting the task state afterwards will be, of course, redundant. Signed-off-by: Davidlohr Bueso --- fs/eventpoll.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/fs/eventpoll.c b/fs/eventpoll.c index f6c023f085f6..ec14e5bcdaa9 100644 --- a/fs/eventpoll.c +++ b/fs/eventpoll.c @@ -1820,15 +1820,18 @@ static int ep_poll(struct eventpoll *ep, struct epoll_event __user *events, res = -EINTR; break; } - if (ep_events_available(ep) || timed_out) + + if (ep_events_available(ep)) break; if (signal_pending(current)) { res = -EINTR; break; } - if (!schedule_hrtimeout_range(to, slack, HRTIMER_MODE_ABS)) + if (!schedule_hrtimeout_range(to, slack, HRTIMER_MODE_ABS)) { timed_out = 1; + break; + } } __set_current_state(TASK_RUNNING); -- 2.16.4