From patchwork Tue Sep 26 14:05:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wen Yang X-Patchwork-Id: 13399267 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CF003E7E638 for ; Tue, 26 Sep 2023 14:05:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231243AbjIZOFy (ORCPT ); Tue, 26 Sep 2023 10:05:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229958AbjIZOFw (ORCPT ); Tue, 26 Sep 2023 10:05:52 -0400 Received: from out162-62-57-210.mail.qq.com (out162-62-57-210.mail.qq.com [162.62.57.210]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF54811D; Tue, 26 Sep 2023 07:05:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1695737140; bh=MJNUG6riqeXQx3T/lMM/Fo45o2kqZs4yb89ZYBEfbas=; h=From:To:Cc:Subject:Date; b=GovrFxyy0wuq6Ew9gX4aCYvFNViEqhk00T4PyyOxJiDZD/h1k8TabzlqTrmaIt2Hy slbeS+zwjQM9EAmS4jeb2c0CTk35yeXoeograhRo29hjOqfaZ1gfFbCrnm80GeAMRS PMPZIFiotHfue4b9otXtwvbj7GL3jlYh2fFoA08Y= Received: from localhost.localdomain ([240e:430:2a38:9767:edcf:1da7:3272:2365]) by newxmesmtplogicsvrsza7-0.qq.com (NewEsmtp) with SMTP id 14F3DC20; Tue, 26 Sep 2023 22:05:15 +0800 X-QQ-mid: xmsmtpt1695737115tmvj1up9w Message-ID: X-QQ-X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+F WEfbDpkehaqgBHcfEG X-QQ-XMRINFO: OD9hHCdaPRBwq3WW+NvGbIU= From: wenyang.linux@foxmail.com To: Alexander Viro , Jens Axboe , Christian Brauner Cc: Wen Yang , Christoph Hellwig , Dylan Yudaken , David Woodhouse , Matthew Wilcox , Eric Biggers , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] eventfd: move 'eventfd-count' printing out of spinlock Date: Tue, 26 Sep 2023 22:05:00 +0800 X-OQ-MSGID: <20230926140500.4944-1-wenyang.linux@foxmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org From: Wen Yang It is better to print debug messages outside of the wqh.lock spinlock where possible. Signed-off-by: Wen Yang Cc: Alexander Viro Cc: Jens Axboe Cc: Christian Brauner Cc: Christoph Hellwig Cc: Dylan Yudaken Cc: David Woodhouse Cc: Matthew Wilcox Cc: Eric Biggers 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));