From patchwork Thu Dec 1 18:11:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Axboe X-Patchwork-Id: 28494 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp412895wrr; Thu, 1 Dec 2022 10:14:44 -0800 (PST) X-Google-Smtp-Source: AA0mqf5RyPc63/0h9JzqYTZp63bFioFCffnmVT5V5s0Scr51QXmEUue/9NQjwcMI8nClZitlCH6D X-Received: by 2002:a17:906:64e:b0:7b7:c1b9:8cb4 with SMTP id t14-20020a170906064e00b007b7c1b98cb4mr41678588ejb.96.1669918484098; Thu, 01 Dec 2022 10:14:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669918484; cv=none; d=google.com; s=arc-20160816; b=IAVhN300Zbs65a8yOIrrZaj2812GQmuYxjyhDbuX9KLanNzzsdJChaIpokXSKSAcMD OLQSrdqMjz23FvcMoH+93xUhNHNvl+gttEVitiYKZkjVP6rj93IlN6RhlqngV3ooeQsO 9ESSywPt/a3blctc2OlWvI3iOwC2FTe7MtmXUh1dGRBzvf6DS6Jvq56RXSqO1Shwe5g/ twG9tG97zYLFEircQbSrYPWEQjqR90VDbsPC0Bhb1u0GEeJCOHKyyWSZNajA9IbzOMXA Be4pgul5izHgh2KQ4ePUAeS7cYPoNvXPUfY8ZJwG0I0DePRkzz+qVq0fZv33H0HnvZ/c z4Sw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=+7XieXpcJrzhapQHtWCNoW0rQy5yiKhkq34SDOyw0xw=; b=ghCz12K3kmB4rpwYyLZTKYYFUoV5ezfWTD+8/4RUPMIZQfB5ZxlOYswiEevDPzg4Yv 8Ws53mPOt2Ysrs9/zBaqvVynszVR5hL5s6A2awSiStmKAO0G9AGdYxqqO2e9ZyOLZwWg wvMLAOwzjkn+xDJdHLY/45cr0VR36ZTIYhSuC/VF3Q7J1AQ1/Z6rFVcB+A3+ZrLIRDKl f3TL6SaFgJnWlwcNdlivN2CdxeTlP4uEw9ZiEb5lrieJTMGwjf3rZ6pIgs00FeKamvm6 u5ZsbXr/QcKhTRTIZ/HHOON6XBZu/YidTcD+IgY1wE2mkUxKTzTVbr3AhO7MbQLVfeZR FmhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel-dk.20210112.gappssmtp.com header.s=20210112 header.b=rCV2Kahu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o13-20020aa7c50d000000b0046abe65b8f7si4037337edq.159.2022.12.01.10.14.20; Thu, 01 Dec 2022 10:14:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel-dk.20210112.gappssmtp.com header.s=20210112 header.b=rCV2Kahu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230185AbiLASMX (ORCPT + 99 others); Thu, 1 Dec 2022 13:12:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36434 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230218AbiLASMI (ORCPT ); Thu, 1 Dec 2022 13:12:08 -0500 Received: from mail-io1-xd2e.google.com (mail-io1-xd2e.google.com [IPv6:2607:f8b0:4864:20::d2e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4BA7AA1C0A for ; Thu, 1 Dec 2022 10:12:08 -0800 (PST) Received: by mail-io1-xd2e.google.com with SMTP id n188so1570042iof.8 for ; Thu, 01 Dec 2022 10:12:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=+7XieXpcJrzhapQHtWCNoW0rQy5yiKhkq34SDOyw0xw=; b=rCV2KahuRSA2UomgHjcLL2MPSHWQzvEOZHnqXl9CNih1pE+gZRpjzdYg3AGoNxGtH/ lrwbTserdKCot3tq/5ePqPYHCEDByLsr5EJeyAa3WUpPRYldyDwDb72H4U+e7EULEDfX YOz044AliNTRJSeVBbissUP76TH1dDpAxrwe5pgd94G4wvCJ4IeVnDfJhMx47sKWeWPs 0C7kWE1xTeT+Dx73CkQ/oLdCov1SSDwhGCyL0CKWRohvyTJvqo4qo5nur82aLKeNrnxf rQRbX7ukSMrqtcrZIvRHBe9oddDEKsDHVoB5vCoS6H8vIAXT8EF6vPM5WVzceR1ifqHH kwow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+7XieXpcJrzhapQHtWCNoW0rQy5yiKhkq34SDOyw0xw=; b=ECi0HhtZe8LEBgsi6nEXZ2dzxsh3uzYYE7KRVome7IhNOqEutPwIdNHRjHihNtaILC GukkJjarid8/Sq/bRhfOxqlVMYLZWzTQ39wAMTrnrQp26nnAmG6YQvbhAIRZSd5bAh3e s+OA1K8DH/z2lG2jdpLQXz4gdhAtWAPiviJGSBH4Sv1zrlPSUtaueM9vkZsw4aCdCLWQ +iYFIvSIRtquRc80ZwWpH6uxMZ/JUFkm4DUJ8Wgs6XQtISGIPhpWwGStOuD/EZ4WjIg+ VhTRlCJKWQnkDkpFgMGvIk3lbtzZLIucBQ3FZthHauWelHI8pPbAv9QmHAyZq+LHl2U+ +aVA== X-Gm-Message-State: ANoB5plKH2CiAggMn5sW2lsOfyuajFY+c5i1S66NkZZDPWbxcvbFLNqI JeBlwhz+YwE6EoDYBJk7c9kbfcO96Knf9rLM X-Received: by 2002:a02:a710:0:b0:389:d089:4233 with SMTP id k16-20020a02a710000000b00389d0894233mr12448957jam.18.1669918327697; Thu, 01 Dec 2022 10:12:07 -0800 (PST) Received: from m1max.localdomain ([207.135.234.126]) by smtp.gmail.com with ESMTPSA id y21-20020a027315000000b00374fe4f0bc3sm1842028jab.158.2022.12.01.10.12.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Dec 2022 10:12:07 -0800 (PST) From: Jens Axboe To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org Cc: soheil@google.com, willemdebruijn.kernel@gmail.com, stefanha@redhat.com, Jens Axboe Subject: [PATCH 4/7] eventpoll: move expires to epoll_wq Date: Thu, 1 Dec 2022 11:11:53 -0700 Message-Id: <20221201181156.848373-5-axboe@kernel.dk> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221201181156.848373-1-axboe@kernel.dk> References: <20221201181156.848373-1-axboe@kernel.dk> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751036444366481746?= X-GMAIL-MSGID: =?utf-8?q?1751036444366481746?= This makes the expiration available to the wakeup handler. No functional changes expected in this patch, purely in preparation for being able to use the timeout on the wakeup side. Signed-off-by: Jens Axboe --- fs/eventpoll.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fs/eventpoll.c b/fs/eventpoll.c index 888f565d0c5f..0994f2eb6adc 100644 --- a/fs/eventpoll.c +++ b/fs/eventpoll.c @@ -1765,6 +1765,7 @@ static int ep_autoremove_wake_function(struct wait_queue_entry *wq_entry, struct epoll_wq { wait_queue_entry_t wait; struct hrtimer timer; + ktime_t timeout_ts; bool timed_out; }; @@ -1825,7 +1826,7 @@ static int ep_poll(struct eventpoll *ep, struct epoll_event __user *events, { int res, eavail; u64 slack = 0; - ktime_t expires, *to = NULL; + ktime_t *to = NULL; struct epoll_wq ewq; lockdep_assert_irqs_enabled(); @@ -1834,7 +1835,7 @@ static int ep_poll(struct eventpoll *ep, struct epoll_event __user *events, if (timeout && (timeout->tv_sec | timeout->tv_nsec)) { slack = select_estimate_accuracy(timeout); - to = &expires; + to = &ewq.timeout_ts; *to = timespec64_to_ktime(*timeout); } else if (timeout) { /*