Received: by 2002:a05:7412:40d:b0:e2:908c:2ebd with SMTP id 13csp1156985rdf; Wed, 22 Nov 2023 07:06:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IGSokCktsWhDTgxEmMlPa6QLtdq374IhvXMShAcAYna9wQTikWJFyUvHa3zx8mSUkPTy2ji X-Received: by 2002:a05:6830:910:b0:6d7:d7d1:926 with SMTP id v16-20020a056830091000b006d7d7d10926mr3069074ott.3.1700665582269; Wed, 22 Nov 2023 07:06:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700665582; cv=none; d=google.com; s=arc-20160816; b=MS0ZlkmNjkg5BK3AZphkudGyxzGfd+Z/U6qlZp/LAB72fehvPIdsvN8UIFCL2dY7QF ajeRDbIE5j9r2IAkmp2GgZnWirtSrQpd7+4jkBejz6ri0cWH6M0Le393w6ZJVUt93Bxt QNoKvULm7NNzSaOXrEpBACSFTG4ntP/2bg59Ny2JP7l0Y0lELcjLxx6siVz7y3Z+rbcF acDin5mK2HuVbT6fy4BbaRCgsNoKjwaTNJp1/HefKUQiuT2YNhcPUTb1VLUdg9NecHG7 PKVLFf7yM48ai1WRddAtUGlkLV8L/rYpObMMWdcMqMQhnnOyRn6mVba76kDxx0mwlk2g G/3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :dkim-signature; bh=mhP7e+31Z9+nB58srBCpzmS+Md5+Kp/dzX7wM4wK75A=; fh=o4Dq6GeO+YpuBESu7iIWE8q03XQ/heY11JZf4WM67Zs=; b=oXdzId1MLVDYpDOUv3sltpUpPKipWEBZHlXSzbB9/uKcgLq7TNxe9fBGr3PVcpmaO4 7Gt5iVQBPhUKk+camUdWVgEgDZGjUOdprg140mOSg9Q/7IHbkxtE1cKiF96WC4IfcaBO nj7v00ObpC02DBB/Wwm/rtkOp7IKuR8ppCHatx9wv3XPHkV4FWeckX+e92Sjcio1OYqL FwsERv/q1Ex1R3KyFi8ctCfeLyJ2IqH9N+xChse7Fp01v4wa9I1CYI8Koad9QovmH17i hH8X8AZvpQN87tJ9WXaACev4SI9jkg67qa8pepunPOPSeQU/QRS9xqLo3Xad0R1MHyiO hLmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=ZcrRoEFw; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=LyVeT+mO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id t19-20020a9d7493000000b006b899ca0249si4499966otk.333.2023.11.22.07.06.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Nov 2023 07:06:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=ZcrRoEFw; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=LyVeT+mO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 3C8EF80FF2BC; Wed, 22 Nov 2023 07:06:14 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344331AbjKVPFu (ORCPT + 99 others); Wed, 22 Nov 2023 10:05:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344403AbjKVPFp (ORCPT ); Wed, 22 Nov 2023 10:05:45 -0500 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA6EFA3; Wed, 22 Nov 2023 07:05:40 -0800 (PST) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 6C86A1F8D9; Wed, 22 Nov 2023 15:05:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1700665539; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=mhP7e+31Z9+nB58srBCpzmS+Md5+Kp/dzX7wM4wK75A=; b=ZcrRoEFwpxJc4wiCEvI5Z6vwSDJRa19aPELohVHLwMcw/gKwapwnuXIaHRJa9vJ+tGL1AJ Ls/CVRotqPlYPG1beOQ8VFeXwe0gt0ftJwH4JcQAtaS9xH9WKxGamyRLuJd3y322CCYv9r qS0Bj5Pp3oItCpC7oV5QKyBTiYqDYO0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1700665539; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=mhP7e+31Z9+nB58srBCpzmS+Md5+Kp/dzX7wM4wK75A=; b=LyVeT+mOky5Yb8PakQHBxFNY5YlaGwagm+iIpbHOizt4yAof2fpPH820159ugYTF4DZisp oyqigpl/uBuPcDAQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 5F6AE13461; Wed, 22 Nov 2023 15:05:39 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 1XhFF8MYXmVqGgAAMHmgww (envelope-from ); Wed, 22 Nov 2023 15:05:39 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id F216FA07DC; Wed, 22 Nov 2023 16:05:38 +0100 (CET) Date: Wed, 22 Nov 2023 16:05:38 +0100 From: Jan Kara To: Christian Brauner Cc: linux-fsdevel@vger.kernel.org, Christoph Hellwig , Jan Kara , Vitaly Kuznetsov , Sean Christopherson , Paolo Bonzini , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, David Woodhouse , Paul Durrant , Oded Gabbay , Wu Hao , Tom Rix , Moritz Fischer , Xu Yilun , Zhenyu Wang , Zhi Wang , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Daniel Vetter , Leon Romanovsky , Jason Gunthorpe , Frederic Barrat , Andrew Donnellan , Arnd Bergmann , Greg Kroah-Hartman , Eric Farman , Matthew Rosato , Halil Pasic , Vineeth Vijayan , Peter Oberparleiter , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Tony Krowiak , Jason Herne , Harald Freudenberger , "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , Diana Craciun , Alex Williamson , Eric Auger , Fei Li , Benjamin LaHaise , Johannes Weiner , Michal Hocko , Roman Gushchin , Shakeel Butt , Muchun Song , Kirti Wankhede , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-fpga@vger.kernel.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-rdma@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, linux-usb@vger.kernel.org, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, linux-aio@kvack.org, cgroups@vger.kernel.org, linux-mm@kvack.org, Jens Axboe , Pavel Begunkov , io-uring@vger.kernel.org Subject: Re: [PATCH v2 3/4] eventfd: simplify eventfd_signal_mask() Message-ID: <20231122150538.6zwikm3tymnkcdxf@quack3> References: <20231122-vfs-eventfd-signal-v2-0-bd549b14ce0c@kernel.org> <20231122-vfs-eventfd-signal-v2-3-bd549b14ce0c@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231122-vfs-eventfd-signal-v2-3-bd549b14ce0c@kernel.org> Authentication-Results: smtp-out2.suse.de; none X-Spam-Level: X-Spam-Score: -6.30 X-Spamd-Result: default: False [-6.30 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; BAYES_HAM(-3.00)[100.00%]; TAGGED_RCPT(0.00)[]; MIME_GOOD(-0.10)[text/plain]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_RATELIMIT(0.00)[to_ip_from(RLmoeddzf3hfwy788do41yajib)]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; RCPT_COUNT_GT_50(0.00)[78]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; MID_RHS_NOT_FQDN(0.50)[]; RCVD_COUNT_TWO(0.00)[2]; FREEMAIL_CC(0.00)[vger.kernel.org,lst.de,suse.cz,redhat.com,google.com,linutronix.de,alien8.de,linux.intel.com,kernel.org,infradead.org,xen.org,intel.com,gmail.com,ffwll.ch,ziepe.ca,linux.ibm.com,arndb.de,linuxfoundation.org,linux.alibaba.com,oss.nxp.com,kvack.org,cmpxchg.org,linux.dev,nvidia.com,lists.freedesktop.org,lists.ozlabs.org,lists.linux-foundation.org,kernel.dk]; SUSPICIOUS_RECIPS(1.50)[] X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Wed, 22 Nov 2023 07:06:14 -0800 (PST) On Wed 22-11-23 13:48:24, Christian Brauner wrote: > The eventfd_signal_mask() helper was introduced for io_uring and similar > to eventfd_signal() it always passed 1 for @n. So don't bother with that > argument at all. > > Signed-off-by: Christian Brauner Nice. Feel free to add: Reviewed-by: Jan Kara Honza > --- > fs/eventfd.c | 7 ++++--- > include/linux/eventfd.h | 5 ++--- > io_uring/io_uring.c | 4 ++-- > 3 files changed, 8 insertions(+), 8 deletions(-) > > diff --git a/fs/eventfd.c b/fs/eventfd.c > index dc9e01053235..a9a6de920fb4 100644 > --- a/fs/eventfd.c > +++ b/fs/eventfd.c > @@ -43,9 +43,10 @@ struct eventfd_ctx { > int id; > }; > > -__u64 eventfd_signal_mask(struct eventfd_ctx *ctx, __u64 n, __poll_t mask) > +__u64 eventfd_signal_mask(struct eventfd_ctx *ctx, __poll_t mask) > { > unsigned long flags; > + __u64 n = 1; > > /* > * Deadlock or stack overflow issues can happen if we recurse here > @@ -68,7 +69,7 @@ __u64 eventfd_signal_mask(struct eventfd_ctx *ctx, __u64 n, __poll_t mask) > current->in_eventfd = 0; > spin_unlock_irqrestore(&ctx->wqh.lock, flags); > > - return n; > + return n == 1; > } > > /** > @@ -84,7 +85,7 @@ __u64 eventfd_signal_mask(struct eventfd_ctx *ctx, __u64 n, __poll_t mask) > */ > __u64 eventfd_signal(struct eventfd_ctx *ctx) > { > - return eventfd_signal_mask(ctx, 1, 0); > + return eventfd_signal_mask(ctx, 0); > } > EXPORT_SYMBOL_GPL(eventfd_signal); > > diff --git a/include/linux/eventfd.h b/include/linux/eventfd.h > index 562089431551..4f8aac7eb62a 100644 > --- a/include/linux/eventfd.h > +++ b/include/linux/eventfd.h > @@ -36,7 +36,7 @@ struct file *eventfd_fget(int fd); > struct eventfd_ctx *eventfd_ctx_fdget(int fd); > struct eventfd_ctx *eventfd_ctx_fileget(struct file *file); > __u64 eventfd_signal(struct eventfd_ctx *ctx); > -__u64 eventfd_signal_mask(struct eventfd_ctx *ctx, __u64 n, __poll_t mask); > +__u64 eventfd_signal_mask(struct eventfd_ctx *ctx, __poll_t mask); > int eventfd_ctx_remove_wait_queue(struct eventfd_ctx *ctx, wait_queue_entry_t *wait, > __u64 *cnt); > void eventfd_ctx_do_read(struct eventfd_ctx *ctx, __u64 *cnt); > @@ -63,8 +63,7 @@ static inline int eventfd_signal(struct eventfd_ctx *ctx) > return -ENOSYS; > } > > -static inline int eventfd_signal_mask(struct eventfd_ctx *ctx, __u64 n, > - unsigned mask) > +static inline int eventfd_signal_mask(struct eventfd_ctx *ctx, unsigned mask) > { > return -ENOSYS; > } > diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c > index ed254076c723..70170a41eac4 100644 > --- a/io_uring/io_uring.c > +++ b/io_uring/io_uring.c > @@ -558,7 +558,7 @@ static void io_eventfd_ops(struct rcu_head *rcu) > int ops = atomic_xchg(&ev_fd->ops, 0); > > if (ops & BIT(IO_EVENTFD_OP_SIGNAL_BIT)) > - eventfd_signal_mask(ev_fd->cq_ev_fd, 1, EPOLL_URING_WAKE); > + eventfd_signal_mask(ev_fd->cq_ev_fd, EPOLL_URING_WAKE); > > /* IO_EVENTFD_OP_FREE_BIT may not be set here depending on callback > * ordering in a race but if references are 0 we know we have to free > @@ -594,7 +594,7 @@ static void io_eventfd_signal(struct io_ring_ctx *ctx) > goto out; > > if (likely(eventfd_signal_allowed())) { > - eventfd_signal_mask(ev_fd->cq_ev_fd, 1, EPOLL_URING_WAKE); > + eventfd_signal_mask(ev_fd->cq_ev_fd, EPOLL_URING_WAKE); > } else { > atomic_inc(&ev_fd->refs); > if (!atomic_fetch_or(BIT(IO_EVENTFD_OP_SIGNAL_BIT), &ev_fd->ops)) > > -- > 2.42.0 > -- Jan Kara SUSE Labs, CR