Received: by 2002:a05:7412:6592:b0:d7:7d3a:4fe2 with SMTP id m18csp1548048rdg; Sat, 12 Aug 2023 06:02:33 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEbrhwRhASirBnwhr3qjY8CdNdABGhemioVXkf6/uK6+dZU7qc9PF1wROYX1lYzONLOSCXT X-Received: by 2002:a05:6a20:4407:b0:140:a6ec:b55e with SMTP id ce7-20020a056a20440700b00140a6ecb55emr4364617pzb.3.1691845353382; Sat, 12 Aug 2023 06:02:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691845353; cv=none; d=google.com; s=arc-20160816; b=YmIJmrvpTRuQk+t0O1JPhF/Lcnv4UfCpa0jAVIlUPkZcVGllOv0lWMRSXLXHiVxRYv QcrS/3a+FixcK9ICURQR7FlLoXn+uqMo+HXOtOBllvOaXNFbkog9yWiZ8RVIWDPI39t6 UOQYn85iqX3NO/2aEV/4HEOuKIpwJlLvhNsIqEHirVoa0s7gPxduXqP9UpRsEd/VqnyS cr6jes0/hrtQWphAAorabM9OCPhOvIz58TKnkHhXQ4PVMw+6pZvAMF+E8AnkLhAvnmYx FTof3o3B+oAMYvdi9cb/Ls2ZN7J+X+0a+NGfqzED1xJ8CowuMCtHwn9CBHmEm8J+Kf/G qLrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=UClbfeDcgLrN9gw9PYVkTWcXPt6ww2x5TRV68gA4hiI=; fh=cIBi9AaxwYvjwpM79gbFOvheXhB2lWjIUWOVRqAAQkc=; b=FBAh+AvVReazcOogjhINWr/V+pk21RLx/iAuNMfVN5GuUrwtw9TQqqSRoj6BUEcfps +DZ1tQebe1QCDBQ2B5stLOLOIiIvro8bey5ILDL21plp2zoZwL3q1cJ8JJjdlqECMCgG slgUeP15n1PgwWuj5z3xy9uCpx8scGmbPLUxmWARKb5OP++malMHISw7g6rSO1P0MKxJ 66sP0NHlS7D7P8UBHL2WGfyfCnr7TMrurSGgpWkbu1Itx188JHWOJsme9eeUf7NWTWgG oWiFjV8f5dxIABUwHaGsxlRq4gexGq/qWNWIKGKe4t2ZCBNefJCOLn1SggtK9qxJX8Wt wKRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=mh6Y4ZEZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c23-20020a63d157000000b0053fb354c194si5013556pgj.659.2023.08.12.06.02.09; Sat, 12 Aug 2023 06:02:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=mh6Y4ZEZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236780AbjHLMiC (ORCPT + 99 others); Sat, 12 Aug 2023 08:38:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229649AbjHLMiA (ORCPT ); Sat, 12 Aug 2023 08:38:00 -0400 Received: from mail-ej1-x62c.google.com (mail-ej1-x62c.google.com [IPv6:2a00:1450:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD7A519A3; Sat, 12 Aug 2023 05:38:03 -0700 (PDT) Received: by mail-ej1-x62c.google.com with SMTP id a640c23a62f3a-99cdb0fd093so396763266b.1; Sat, 12 Aug 2023 05:38:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691843882; x=1692448682; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=UClbfeDcgLrN9gw9PYVkTWcXPt6ww2x5TRV68gA4hiI=; b=mh6Y4ZEZNsyNB3U7m5PslH3Ec3aMSRICP6qsSSA35bJik7XE1bXlzPV4G2IvonEBmL P1vgs5rslx+GlIWKkENxVFFheO/KpA5bNNek4UnkDK/HbpwTubAsf4uai1aH+zpKC/t+ qEvyiBZ/nGp/ZYxgQS5fTv8ZgmHEYOkxpwM/zLYbttCEwhrSg9VEteT1YT2hCm5+z+7K T5VMWnO5NSc9WRa9af7uhl5EVmCa3Pe44axlqza2W9q3iTu6/UOANb1rHMygQYZR/fRI uxT3ltNBVCbqXXiqBzK07TznU5CKKmCtQPYjh49anInv3w/Y+t0pe6MAkc+toCdURrB9 AD5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691843882; x=1692448682; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=UClbfeDcgLrN9gw9PYVkTWcXPt6ww2x5TRV68gA4hiI=; b=hauhC2IHEYV6XgBhZZbFME/sUcDFJWOwDt1lREmgmqL4DMxhtgPSysXgzM5NqqGhJt oiwswV/7j+qNFH6xKDMWM+poW4DnM69FBCRhvrjdwQbu1MJmyvckRpo81s2hbvMQl1Wu DNsHWwa95SyMD5zmqNoLwxwsv867lSCqN1B5T8slJKkabLI0eSJTxK/3URY0sYfWHFtB L4zPALu858ZVd6zCGCd97Q7WXwgTeB4ThDUW+tLpqdjpuQeQ+sr7PuLAjNYbhD5IoNH+ OGFm1imsHYVAEllQ8jbh1AZiPVcNCusf/2q+GlHrw00f6D5dUKtBGywI0ATPB1L6TBSX twSg== X-Gm-Message-State: AOJu0YwioOOxDJpdUd5FufGKpBZXRHeZtCws9G7F9Z/Kb5uC2604meFU fu/n2HA6vdUxkTHut53QN2180ZSeEM8= X-Received: by 2002:a17:906:291:b0:99b:efd3:3dcc with SMTP id 17-20020a170906029100b0099befd33dccmr4173224ejf.62.1691843882069; Sat, 12 Aug 2023 05:38:02 -0700 (PDT) Received: from f.. (cst-prg-75-195.cust.vodafone.cz. [46.135.75.195]) by smtp.gmail.com with ESMTPSA id ov14-20020a170906fc0e00b0099290e2c163sm3402567ejb.204.2023.08.12.05.38.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 12 Aug 2023 05:38:01 -0700 (PDT) From: Mateusz Guzik To: brauner@kernel.org Cc: viro@zeniv.linux.org.uk, torvalds@linux-foundation.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Mateusz Guzik Subject: [PATCH] vfs: remove spin_lock_prefetch(&sb->s_inode_list_lock) from new_inode Date: Sat, 12 Aug 2023 14:37:57 +0200 Message-Id: <20230812123757.1666664-1-mjguzik@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org It showed up in 2001, in the following commit in a historical repo [1]: commit c37fa164f793735b32aa3f53154ff1a7659e6442 Author: linus1 Date: Thu Aug 16 11:00:00 2001 -0800 v2.4.9.9 -> v2.4.9.10 with a changelog which does not mention it. Since then the line got only touched up to keep compiling. While it may have been of benefit back in the day, it is guaranteed to at best not get in the way in the multicore setting -- as the code performs *a lot* of work between the prefetch and actual lock acquire, any contention means the cacheline is already invalid by the time the routine calls spin_lock(). It adds spurious traffic, for short. On top of it prefetch is notoriously tricky to use for single-threaded purposes, making it questionable from the get go. As such, remove it. I concede upfront I did not see value in benchmarking this change, but I can do it if that is deemed appropriate. Also worth nothing is that this was the only remaining consumer. [1] https://git.kernel.org/pub/scm/linux/kernel/git/tglx/history.git/commit/fs/inode.c?id=c37fa164f793735b32aa3f53154ff1a7659e6442 Signed-off-by: Mateusz Guzik --- fs/inode.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/fs/inode.c b/fs/inode.c index 8fefb69e1f84..67611a360031 100644 --- a/fs/inode.c +++ b/fs/inode.c @@ -16,7 +16,6 @@ #include #include #include -#include #include /* for inode_has_buffers */ #include #include @@ -1041,8 +1040,6 @@ struct inode *new_inode(struct super_block *sb) { struct inode *inode; - spin_lock_prefetch(&sb->s_inode_list_lock); - inode = new_inode_pseudo(sb); if (inode) inode_sb_list_add(inode); -- 2.39.2