From patchwork Fri Dec 13 13:50:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13907062 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 28492E77182 for ; Fri, 13 Dec 2024 13:51:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BA31C6B0098; Fri, 13 Dec 2024 08:51:12 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B540B6B0099; Fri, 13 Dec 2024 08:51:12 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9F3AF6B009A; Fri, 13 Dec 2024 08:51:12 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 7DAD56B0098 for ; Fri, 13 Dec 2024 08:51:12 -0500 (EST) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id EE222C0F3E for ; Fri, 13 Dec 2024 13:51:11 +0000 (UTC) X-FDA: 82890071796.05.771AE85 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf05.hostedemail.com (Postfix) with ESMTP id 426CE100003 for ; Fri, 13 Dec 2024 13:50:21 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Opmb7oMZ; spf=pass (imf05.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1734097846; a=rsa-sha256; cv=none; b=8Ux7aeOFVW6RSI3/5nESV8sgmUkhBwDqkOcTdjN+ht6LZIf369HGyxrzSidAxp0yK4eIcO MWvQOic7kklFl7Kb1l0v1HBH4w89rxDY7MuAlwrSaEBfgG/pKbVmlTFHa881VhQqJeqVjo 64nOn78ddA+/gTfQzlhUKFa6x3gEWqE= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Opmb7oMZ; spf=pass (imf05.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1734097846; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=dahqI5gLkGfD05TuY+PqQn3pxJDwXGZGfLY3MOFYgVE=; b=h4Dq91EocbmKttRiFIm+ZRx42xRkn2CnLj7QodMhiPoQgCR1YcVVPh75ynFWnU3uEgvbWF bCQO98s77q68a/9Xm4E8fgurkdibdNTYEA8vQFRHwxADfzExRZmrkzQNcrF449MSLAvbnp deDhrHISeASBMtDD76Ymb0yvS06pO2k= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1734097869; 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=dahqI5gLkGfD05TuY+PqQn3pxJDwXGZGfLY3MOFYgVE=; b=Opmb7oMZAhU19zFew4Q9s26TEEmklbZ5TZuYFqxDphnYwpLHeZXyUlUyScVyHcke6r3zbL VHWOeS36i2WmfsHH/Bx0ky0XZ28jnIWBIa4wJbLZ0+IUMlhvv0Xlq2eIkTeHfKiJc9gm0D u8KznsG5+25p0n4DvHaG3V2MMw6MUYk= Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-692-NQm--YxLM0SK64NOpZx29g-1; Fri, 13 Dec 2024 08:51:06 -0500 X-MC-Unique: NQm--YxLM0SK64NOpZx29g-1 X-Mimecast-MFC-AGG-ID: NQm--YxLM0SK64NOpZx29g Received: from mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.40]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 2E4CD19560B5; Fri, 13 Dec 2024 13:51:02 +0000 (UTC) Received: from warthog.procyon.org.uk.com (unknown [10.42.28.48]) by mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 058071955F40; Fri, 13 Dec 2024 13:50:56 +0000 (UTC) From: David Howells To: Christian Brauner Cc: David Howells , Max Kellermann , Ilya Dryomov , Xiubo Li , Trond Myklebust , Jeff Layton , Matthew Wilcox , netfs@lists.linux.dev, linux-afs@lists.infradead.org, linux-cifs@vger.kernel.org, linux-nfs@vger.kernel.org, ceph-devel@vger.kernel.org, v9fs@lists.linux.dev, linux-erofs@lists.ozlabs.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Zilin Guan , Akira Yokosawa Subject: [PATCH 06/10] netfs: Remove redundant use of smp_rmb() Date: Fri, 13 Dec 2024 13:50:06 +0000 Message-ID: <20241213135013.2964079-7-dhowells@redhat.com> In-Reply-To: <20241213135013.2964079-1-dhowells@redhat.com> References: <20241213135013.2964079-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.40 X-Rspamd-Queue-Id: 426CE100003 X-Stat-Signature: 11p6wfffgfhihi5my38opcmoudyft9hc X-Rspam-User: X-Rspamd-Server: rspam09 X-HE-Tag: 1734097821-480289 X-HE-Meta: U2FsdGVkX1+wWEhwoJTJDhHNrAzMRAIfgnYZy1VeoU8rYCnjdONjZzWg/ZvFvQVhdV1k65o6hvxI1eaRykdIHG6Zs9EnBJ8DlAEFmj36UTfyZ9lXJRE+TJU1fkfXhnuNq367zkMXUL943BojUC1ruoj/NGtbOmO0e9ggFmxqa/57/H5YoZssyMWxQtYDSsmFnc69NLrzHDhTJkwV5BFRJj/7GCwh6xYXc4TfxF4pQxO6lgd08PBBuXNNTBYLlu5tfGeJGaF9Bo0dSROmJIcsslbYfJll1Yj79t/tD75hxxMoseqe6gFIFd6IbVnRXCqtGq2vqOOBv/MJQ8cOFXrWDCxLwL7KsCyjIgGwbd1LxJ3mL6C3dcxuSe51GQ+lsaSAlqkRU00cr4EzCrKT6eP/P2LCa8JmlbpWsuhlMNufB5qElciH4FVaBn6wvcoK9Pw5JujaGHeOBOyNtLAoEAsc1VWP7+56v3wfL6poY1gUKbCnMufwnkivFl1iWk6IFDGNjjgOC9C5p4XNiT5bwTBgwkXASclCJqgQrUYtIALXgItc6bWHn5dlmmrrPRVJBArf4FX2YJqCrcUJitHKH3f3K9CTX+vUCxpIPJCMpXQsd4Fn/7a97pSW/NXf6wtZ65caN5beKJ1yie/CJf/RxWGEE8IWTqIQSjKDYRUB1zqyS6tK3RdVmhsAHprhzNJqjVlDSMCWOCGaYVmfhHRnbKwGV31pOXU3FWnhzWK5+cPhf3fscUPgUUyZ9Y4H3VZFM2ImGLsM98EWKshyKRds0fLnDtkLaS+lzmOTjlt6UtjV20IrqpWzkttRgpF+HK/mz56DsksitjsFdYVMpcdfkC/SKd4gbQ9+bvlC8txaPN/tOnd/RsXPtJ0cFoNBqJh4NgvT40AAvj9UbF11gEpSAZ5fZssT5iNd7vJBvWrj+2Qs28tvIgtatUcreU8hajnZOrNtglWWsUgwli8n/rpp+hr rt1P3GS3 nooEvX5Yh0PyFESfeE+v+tNjl4ZaCgqDw3uxCtmrN2KbQO/oFSefZ4ws+CrxPJFw2EE2bzlW6Lnft2UZ4rnskkxFDglvcUeySJOzwenlvxfxt85Npxh/GVDGH/yEPtjgOFHYtUhEuuZVS86+T/tE7Yvr4MhMlL/udPx27WZPrhdAwj+naGJ9W9Lx9VsB2JesS7RkwA7hwdCG8DBDiXDjL2+ET00azZs9FFBUeE6CLEKZTQ+L426Iu/8sFdRRJ8t0PUpaJmibupept4HTS9N0ELW9kLxqcWKa4aJ6BMvzLEv71jvrYqonpiNoPpkJFaWLIgFIhZ9IMzhvkfSmVqA1ZwXCaDFlzWKdX9wQlmSaGwTn5T8dBjoq6y/xd69usTkCDagVpHeZGPzqnywfpjwBBndyX6au1Gphen+6FRcn1s3rcWoyq2CL1sYGRL04ZeBT4g1H7 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: From: Zilin Guan The function netfs_unbuffered_write_iter_locked() in fs/netfs/direct_write.c contains an unnecessary smp_rmb() call after wait_on_bit(). Since wait_on_bit() already incorporates a memory barrier that ensures the flag update is visible before the function returns, the smp_rmb() provides no additional benefit and incurs unnecessary overhead. This patch removes the redundant barrier to simplify and optimize the code. Signed-off-by: Zilin Guan Signed-off-by: David Howells cc: Akira Yokosawa cc: Jeff Layton cc: netfs@lists.linux.dev cc: linux-fsdevel@vger.kernel.org Link: https://lore.kernel.org/r/20241207021952.2978530-1-zilin@seu.edu.cn/ Reviewed-by: Akira Yokosawa --- fs/netfs/direct_write.c | 1 - 1 file changed, 1 deletion(-) diff --git a/fs/netfs/direct_write.c b/fs/netfs/direct_write.c index 88f2adfab75e..173e8b5e6a93 100644 --- a/fs/netfs/direct_write.c +++ b/fs/netfs/direct_write.c @@ -104,7 +104,6 @@ ssize_t netfs_unbuffered_write_iter_locked(struct kiocb *iocb, struct iov_iter * trace_netfs_rreq(wreq, netfs_rreq_trace_wait_ip); wait_on_bit(&wreq->flags, NETFS_RREQ_IN_PROGRESS, TASK_UNINTERRUPTIBLE); - smp_rmb(); /* Read error/transferred after RIP flag */ ret = wreq->error; if (ret == 0) { ret = wreq->transferred;