From patchwork Fri Mar 10 16:07:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 67541 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp972532wrd; Fri, 10 Mar 2023 08:37:11 -0800 (PST) X-Google-Smtp-Source: AK7set90/wYMP17HCCcUHIiQuFm4pLkthD6sQw5Os4PtgqaIlokBV23xf8PpB6cc0K4vSaZidesT X-Received: by 2002:a17:90b:33cc:b0:233:e0d5:a2b8 with SMTP id lk12-20020a17090b33cc00b00233e0d5a2b8mr7267382pjb.29.1678466231458; Fri, 10 Mar 2023 08:37:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678466231; cv=none; d=google.com; s=arc-20160816; b=i9oM1GktvpbunQFfNOeEsVubjtRnqMimli1uWlRLJpPn2F0WeZ4tMayFzIdgiWLY4g 6lx81A7lnb7bIo6rfVnK4qWD/v8MQz8x3yOwUcRZGtcGZJA7uNsJ+QuimHANOKfk0hfA TQl3ABalI2I7iGpTdN4gxOmnuy6FH6Es2fWhXxwW7vHSmCqHTryLphvCm/LxMixeNViy Am7lVC3ddAtz+AJoiCSRGa4HOvd9FK45lt9kW32k1tYTc0P+PrHh6cO5YHHqXM2Yi5va QqScYPxUdunwDdpnlJXYzobn20bNVZE4VZ0hT3dTL1Vzyrcog9//H8hhr9wgcGt8zFD0 CrVA== 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=//zLnPtP7ffouA+rSDdqgf7g3qQX7GQTNEvg0EWo8xg=; b=mqW0eAQ0wUy/qzkIKEX/wfyjjavPBKz8vAwyns8IUXTJ7ccB7gQssOwLgK2pNUfTbG BTixwMHs/UN1E7+S/35D2WdngIj24GdsbgCWNdofjCydyf9lg9sgC/2U6HA7BAPb2ZGu 7uf40el0xNtHiO8XcYKGBN7lrKaJXIEJGA6wFKq1LMIx97bVYR8UPbUQj7PXr3vtH7M5 j2Y4Jx/zPvtN7kVsKv8GZbyVGmQD4F32wQlzCDkzjTh+G5X2tj4SKzdGUeIqKnp8N7zt 9+SkO2jbIWeK/cdUIEnIXls/iMvrfv6UmQKei1zjXsI8vMmAPAF7Q21zhADb7C96Gggx HDpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=cA2nIoF7; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l10-20020a17090a384a00b002296a8ff568si186762pjf.152.2023.03.10.08.36.58; Fri, 10 Mar 2023 08:37:11 -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=@redhat.com header.s=mimecast20190719 header.b=cA2nIoF7; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232110AbjCJQOo (ORCPT + 99 others); Fri, 10 Mar 2023 11:14:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232228AbjCJQMj (ORCPT ); Fri, 10 Mar 2023 11:12:39 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44FB311C8CD for ; Fri, 10 Mar 2023 08:09:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678464495; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=//zLnPtP7ffouA+rSDdqgf7g3qQX7GQTNEvg0EWo8xg=; b=cA2nIoF7Vknl492Pc293uNcTLEV30/h3UtaNuo3hOSfhPuD2RXqprM0kRHgC5AJ+e98aDu oO1ks7MG/vf9TGrYUyeL6GF0/MRywluQ7nvm+zeXb/zbPbyefQqe2S3XLMr0GyJRw4ctyM JqS850LvasHi9jxDrCEwMxc850KrsbI= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-323-afljF5ZuNkeaMFMQAyeZBQ-1; Fri, 10 Mar 2023 11:08:08 -0500 X-MC-Unique: afljF5ZuNkeaMFMQAyeZBQ-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 97EDA80418A; Fri, 10 Mar 2023 16:08:06 +0000 (UTC) Received: from thuth.com (unknown [10.45.224.202]) by smtp.corp.redhat.com (Postfix) with ESMTP id BB616492C3E; Fri, 10 Mar 2023 16:08:04 +0000 (UTC) From: Thomas Huth To: linux-kernel@vger.kernel.org, Arnd Bergmann Cc: linux-arch@vger.kernel.org, Chas Williams <3chas3@gmail.com>, Palmer Dabbelt , linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-atm-general@lists.sourceforge.net, netdev@vger.kernel.org, Christoph Hellwig Subject: [PATCH v2 2/5] Move ep_take_care_of_epollwakeup() to fs/eventpoll.c Date: Fri, 10 Mar 2023 17:07:54 +0100 Message-Id: <20230310160757.199253-3-thuth@redhat.com> In-Reply-To: <20230310160757.199253-1-thuth@redhat.com> References: <20230310160757.199253-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=unavailable 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?1759999407227464679?= X-GMAIL-MSGID: =?utf-8?q?1759999407227464679?= From: Palmer Dabbelt This doesn't make any sense to expose to userspace, so it's been moved to the one user. This was introduced by commit 95f19f658ce1 ("epoll: drop EPOLLWAKEUP if PM_SLEEP is disabled"). Signed-off-by: Palmer Dabbelt Reviewed-by: Andrew Waterman Reviewed-by: Albert Ou Message-Id: <1447119071-19392-7-git-send-email-palmer@dabbelt.com> [thuth: Rebased to fix contextual conflicts] Reviewed-by: Arnd Bergmann Reviewed-by: Christoph Hellwig Signed-off-by: Thomas Huth --- fs/eventpoll.c | 13 +++++++++++++ include/uapi/linux/eventpoll.h | 12 ------------ 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/fs/eventpoll.c b/fs/eventpoll.c index 64659b110973..e2a5d2cc9051 100644 --- a/fs/eventpoll.c +++ b/fs/eventpoll.c @@ -2042,6 +2042,19 @@ SYSCALL_DEFINE1(epoll_create, int, size) return do_epoll_create(0); } +#ifdef CONFIG_PM_SLEEP +static inline void ep_take_care_of_epollwakeup(struct epoll_event *epev) +{ + if ((epev->events & EPOLLWAKEUP) && !capable(CAP_BLOCK_SUSPEND)) + epev->events &= ~EPOLLWAKEUP; +} +#else +static inline void ep_take_care_of_epollwakeup(struct epoll_event *epev) +{ + epev->events &= ~EPOLLWAKEUP; +} +#endif + static inline int epoll_mutex_lock(struct mutex *mutex, int depth, bool nonblock) { diff --git a/include/uapi/linux/eventpoll.h b/include/uapi/linux/eventpoll.h index e687658843b1..cfbcc4cc49ac 100644 --- a/include/uapi/linux/eventpoll.h +++ b/include/uapi/linux/eventpoll.h @@ -85,16 +85,4 @@ struct epoll_event { __u64 data; } EPOLL_PACKED; -#ifdef CONFIG_PM_SLEEP -static inline void ep_take_care_of_epollwakeup(struct epoll_event *epev) -{ - if ((epev->events & EPOLLWAKEUP) && !capable(CAP_BLOCK_SUSPEND)) - epev->events &= ~EPOLLWAKEUP; -} -#else -static inline void ep_take_care_of_epollwakeup(struct epoll_event *epev) -{ - epev->events &= ~EPOLLWAKEUP; -} -#endif #endif /* _UAPI_LINUX_EVENTPOLL_H */