* [PATCH] eventfd: move 'eventfd-count' printing out of spinlock
@ 2023-09-26 14:05 wenyang.linux
2023-09-27 7:32 ` Jens Axboe
0 siblings, 1 reply; 3+ messages in thread
From: wenyang.linux @ 2023-09-26 14:05 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>
It is better to print debug messages outside of the wqh.lock
spinlock where possible.
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 | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/fs/eventfd.c b/fs/eventfd.c
index 33a918f9566c..6c5fe0f40aa5 100644
--- a/fs/eventfd.c
+++ b/fs/eventfd.c
@@ -295,11 +295,13 @@ static ssize_t eventfd_write(struct file *file, const char __user *buf, size_t c
static void eventfd_show_fdinfo(struct seq_file *m, struct file *f)
{
struct eventfd_ctx *ctx = f->private_data;
+ unsigned long long count;
spin_lock_irq(&ctx->wqh.lock);
- seq_printf(m, "eventfd-count: %16llx\n",
- (unsigned long long)ctx->count);
+ count = ctx->count;
spin_unlock_irq(&ctx->wqh.lock);
+
+ seq_printf(m, "eventfd-count: %16llx\n", count);
seq_printf(m, "eventfd-id: %d\n", ctx->id);
seq_printf(m, "eventfd-semaphore: %d\n",
!!(ctx->flags & EFD_SEMAPHORE));
--
2.25.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] eventfd: move 'eventfd-count' printing out of spinlock
2023-09-26 14:05 [PATCH] eventfd: move 'eventfd-count' printing out of spinlock wenyang.linux
@ 2023-09-27 7:32 ` Jens Axboe
2023-10-02 15:12 ` Wen Yang
0 siblings, 1 reply; 3+ messages in thread
From: Jens Axboe @ 2023-09-27 7:32 UTC (permalink / raw)
To: wenyang.linux, Alexander Viro, Christian Brauner
Cc: Christoph Hellwig, Dylan Yudaken, David Woodhouse,
Matthew Wilcox, Eric Biggers, linux-fsdevel, linux-kernel
On 9/26/23 8:05 AM, wenyang.linux@foxmail.com wrote:
> From: Wen Yang <wenyang.linux@foxmail.com>
>
> It is better to print debug messages outside of the wqh.lock
> spinlock where possible.
Does it really matter for fdinfo? Your commit message is a bit
light, so I'm having to guess whether this is fixing a real issue
for you, or if it's just a drive-by observation.
--
Jens Axboe
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] eventfd: move 'eventfd-count' printing out of spinlock
2023-09-27 7:32 ` Jens Axboe
@ 2023-10-02 15:12 ` Wen Yang
0 siblings, 0 replies; 3+ messages in thread
From: Wen Yang @ 2023-10-02 15:12 UTC (permalink / raw)
To: Jens Axboe, Alexander Viro, Christian Brauner
Cc: Christoph Hellwig, Dylan Yudaken, David Woodhouse,
Matthew Wilcox, Eric Biggers, linux-fsdevel, linux-kernel
On 2023/9/27 15:32, Jens Axboe wrote:
> On 9/26/23 8:05 AM,wenyang.linux@foxmail.com wrote:
>> From: Wen Yang<wenyang.linux@foxmail.com>
>>
>> It is better to print debug messages outside of the wqh.lock
>> spinlock where possible.
> Does it really matter for fdinfo? Your commit message is a bit
> light, so I'm having to guess whether this is fixing a real issue
> for you, or if it's just a drive-by observation.
>
Thanks for your comments.
There is a business running on our machine that frequently calls
eventfd_write().
We will resend the V2 and provide a detailed explanation.
--
Best wishes,
Wen
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-10-02 15:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-26 14:05 [PATCH] eventfd: move 'eventfd-count' printing out of spinlock wenyang.linux
2023-09-27 7:32 ` Jens Axboe
2023-10-02 15:12 ` Wen Yang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®