All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] eventfd: show the EFD_SEMAPHORE flag in fdinfo
@ 2023-06-13 17:01 wenyang.linux
  2023-06-14  8:09 ` Christian Brauner
  0 siblings, 1 reply; 2+ messages in thread
From: wenyang.linux @ 2023-06-13 17:01 UTC (permalink / raw)
  To: Alexander Viro, Jens Axboe, Christian Brauner
  Cc: Wen Yang, Christoph Hellwig, Dylan Yudaken, David Woodhouse,
	Matthew Wilcox, Eric Biggers, linux-fsdevel, linux-kernel

From: Wen Yang <wenyang.linux@foxmail.com>

The EFD_SEMAPHORE flag should be displayed in fdinfo,
as different value could affect the behavior of eventfd.

Suggested-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Wen Yang <wenyang.linux@foxmail.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Christian Brauner <brauner@kernel.org>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Dylan Yudaken <dylany@fb.com>
Cc: David Woodhouse <dwmw@amazon.co.uk>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Eric Biggers <ebiggers@google.com>
Cc: linux-fsdevel@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
 fs/eventfd.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/fs/eventfd.c b/fs/eventfd.c
index 6c06a527747f..8aa36cd37351 100644
--- a/fs/eventfd.c
+++ b/fs/eventfd.c
@@ -33,10 +33,10 @@ struct eventfd_ctx {
 	/*
 	 * Every time that a write(2) is performed on an eventfd, the
 	 * value of the __u64 being written is added to "count" and a
-	 * wakeup is performed on "wqh". A read(2) will return the "count"
-	 * value to userspace, and will reset "count" to zero. The kernel
-	 * side eventfd_signal() also, adds to the "count" counter and
-	 * issue a wakeup.
+	 * wakeup is performed on "wqh". If EFD_SEMAPHORE flag was not
+	 * specified, a read(2) will return the "count" value to userspace,
+	 * and will reset "count" to zero. The kernel side eventfd_signal()
+	 * also, adds to the "count" counter and issue a wakeup.
 	 */
 	__u64 count;
 	unsigned int flags;
@@ -301,6 +301,8 @@ static void eventfd_show_fdinfo(struct seq_file *m, struct file *f)
 		   (unsigned long long)ctx->count);
 	spin_unlock_irq(&ctx->wqh.lock);
 	seq_printf(m, "eventfd-id: %d\n", ctx->id);
+	seq_printf(m, "eventfd-semaphore: %d\n",
+		   !!(ctx->flags & EFD_SEMAPHORE));
 }
 #endif
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] eventfd: show the EFD_SEMAPHORE flag in fdinfo
  2023-06-13 17:01 [PATCH v2] eventfd: show the EFD_SEMAPHORE flag in fdinfo wenyang.linux
@ 2023-06-14  8:09 ` Christian Brauner
  0 siblings, 0 replies; 2+ messages in thread
From: Christian Brauner @ 2023-06-14  8:09 UTC (permalink / raw)
  To: wenyang.linux
  Cc: Christian Brauner, Christoph Hellwig, Dylan Yudaken,
	David Woodhouse, Matthew Wilcox, Eric Biggers, linux-fsdevel,
	linux-kernel, Alexander Viro, Jens Axboe

On Wed, 14 Jun 2023 01:01:22 +0800, wenyang.linux@foxmail.com wrote:
> The EFD_SEMAPHORE flag should be displayed in fdinfo,
> as different value could affect the behavior of eventfd.
> 
> 

Applied to the vfs.misc branch of the vfs/vfs.git tree.
Patches in the vfs.misc branch should appear in linux-next soon.

Please report any outstanding bugs that were missed during review in a
new review to the original patch series allowing us to drop it.

It's encouraged to provide Acked-bys and Reviewed-bys even though the
patch has now been applied. If possible patch trailers will be updated.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs.misc

[1/1] eventfd: show the EFD_SEMAPHORE flag in fdinfo
      https://git.kernel.org/vfs/vfs/c/33c8c098aaf6

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-06-14  8:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-13 17:01 [PATCH v2] eventfd: show the EFD_SEMAPHORE flag in fdinfo wenyang.linux
2023-06-14  8:09 ` Christian Brauner

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.