Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp16867643rwd; Mon, 26 Jun 2023 16:47:37 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5UEYuMc1OofQbn0pVE2RNn8jdAZYbv5UrAGC4J4EaZ8ZMSbNSLCwFnUritffVqLKEyk8X9 X-Received: by 2002:a17:90b:3b41:b0:262:f872:fa77 with SMTP id ot1-20020a17090b3b4100b00262f872fa77mr3332042pjb.31.1687823257520; Mon, 26 Jun 2023 16:47:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687823257; cv=none; d=google.com; s=arc-20160816; b=ml1Sqq4+DNn1GMWpRe2KylSgXFx1lf7cb6rAed6iHGtpgIxdFqgLWhekOXMeNSKkNe L2FYHPxjOFaij4Ek8c3Ebu6ldiFTUIggdgGWUnhiibh4kjdBtNRQ7QFKEb3ViE9Vk4ol wuk2Ufkhn3+4cL8Lc0nrwrBEwrs1yyWh7LOrglUVRYNjQG6lF8JD7/qlQwPiq4snO0IH 2U13zvhpzGuQccTG5Ts0OwlbgZc2kvhvD2n1DzXHnXHQjgA+8z3cVkzDZtGs1io6vJKB e9D8MeYjKN8pJ6G5sUOO2ALJ+9jyc2pl2wbNoX65zhyrKnTIxxfitv6zJlprz6c94WtC Qwjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=pIFsN2elWZC5RqViV1mbnouEvdYpsztruO1AICvp7AE=; fh=zskkmVVBkgusAMOgrS0VidFFb8j8hOOVi5WMeOHk1rI=; b=Q7agxJ9WeIsm1NhoBY6Or4fxeCgb/f4TfoGpqVvp5cGkhNz/VUgfg2xDFnAYhQmZxB 69mRYZ9++fiDz+aGFbmN/7tVADO5n08Ka7r2BbbLbKsLI6U49Ds+WEWSNifCNCy2bF+k sHLwaE3WWr1k7xSUu7rgVieT8/mzKCOaCg64U+WivDvTT2cT3svoWGZX5b5jpil6DTFt 1WIw7zj7yWI0MfspbBlUOxE1HBoQjkHFHdwwIhXE4KrMBHl4X5bjyTVhP8gdjhNDeTr8 ttPQ+6SwNtF1il4pU+ovQn+D6JYArYJQXFQ96SOCLLNBoZQxfl+PDwcyIT1/RJM1lbtC mYmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fromorbit-com.20221208.gappssmtp.com header.s=20221208 header.b=x62up01Q; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=fromorbit.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h20-20020a17090ac39400b00262f99a851asi2296509pjt.96.2023.06.26.16.47.00; Mon, 26 Jun 2023 16:47:37 -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=@fromorbit-com.20221208.gappssmtp.com header.s=20221208 header.b=x62up01Q; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=fromorbit.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229740AbjFZXaR (ORCPT + 99 others); Mon, 26 Jun 2023 19:30:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60080 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229495AbjFZXaP (ORCPT ); Mon, 26 Jun 2023 19:30:15 -0400 Received: from mail-oi1-x231.google.com (mail-oi1-x231.google.com [IPv6:2607:f8b0:4864:20::231]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C73DD198C for ; Mon, 26 Jun 2023 16:30:14 -0700 (PDT) Received: by mail-oi1-x231.google.com with SMTP id 5614622812f47-3a0423ea74eso2795489b6e.1 for ; Mon, 26 Jun 2023 16:30:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fromorbit-com.20221208.gappssmtp.com; s=20221208; t=1687822214; x=1690414214; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=pIFsN2elWZC5RqViV1mbnouEvdYpsztruO1AICvp7AE=; b=x62up01QN61j8uRDxz5+FQdVAIz4y5nE7af1TY1P6HUsA8oRbu2KL5BdSvzt4zsimY q0xyw5eF/2C4e4Jflz/eOnqHI6nEqIwnvBAJPvAGi0ulO4nAe5EzJrdufGs9TEMsxWvH vZs34YLgDNK/0PQmZiOPakarhsOs6gtF1LsMCu8HxHF34dqM1920OHH2zqLFfFuEKsjR h6glMEWDE51bc2/JU5JpEKbQVfmu2CTf4s9dwn4ogd7qA4pldpwiivy9X1uyJmkCGvS9 ro0NeDMgmkuHJ2V0qnJcMlHSeJbdgGNuRwVIkTM2ndk40U1wP8cKBuAAAeWzQw4a1nQZ 6SBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687822214; x=1690414214; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=pIFsN2elWZC5RqViV1mbnouEvdYpsztruO1AICvp7AE=; b=OxlfuItHVa/JRnRjJUY8Ch+HHJax9uQMXqCbNohA1IawBlUliI/g2Kq6nLZ/KyXe8l R9uGFsdQLqjrHewW4bDT45HhLMphYco0i950F1rpqM0KLB0xRKRv4ceMfLQR5SFcw0ZG sYMQZHdi+2d8+nYIjhEOmxyzT84xwaHp/lGt7YkmFLlG5ON/zUerinHbsjRvm2kZZnw+ lBClNJzAGINbpYVAcksNv+Hav9cdcX73zN+zM5Dg3vntwryJnsvHzwXkrL9cOpYmRPEA LotBZSt/hmTi9L54BnQPvHFRZIfauTd8c5PrxT0+IchlaNUXeJOymuy+jdWrGLI3uLUm FdQg== X-Gm-Message-State: AC+VfDy1/gLTzxtU7eVTKlyNwbecYCCRsyIXfeFMvqe4IxHmPesEFjSo onzb1KRe20l8oxIymsRhlxObJA== X-Received: by 2002:a54:4186:0:b0:3a1:a5a7:ec58 with SMTP id 6-20020a544186000000b003a1a5a7ec58mr8996933oiy.0.1687822214105; Mon, 26 Jun 2023 16:30:14 -0700 (PDT) Received: from dread.disaster.area (pa49-186-94-37.pa.vic.optusnet.com.au. [49.186.94.37]) by smtp.gmail.com with ESMTPSA id j3-20020a635943000000b00553b546a638sm4563860pgm.67.2023.06.26.16.30.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jun 2023 16:30:13 -0700 (PDT) Received: from dave by dread.disaster.area with local (Exim 4.96) (envelope-from ) id 1qDver-00Gc0G-1Q; Tue, 27 Jun 2023 09:30:09 +1000 Date: Tue, 27 Jun 2023 09:30:09 +1000 From: Dave Chinner To: Matthew Wilcox Cc: Marcelo Tosatti , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Alexander Viro , Christian Brauner , Christoph Hellwig , Jens Axboe , Frederic Weisbecker , Valentin Schneider , Leonardo Bras , Yair Podemsky , P J P Subject: Re: [PATCH] fs/buffer.c: remove per-CPU buffer_head lookup cache Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE 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 On Mon, Jun 26, 2023 at 07:47:42PM +0100, Matthew Wilcox wrote: > On Mon, Jun 26, 2023 at 03:04:53PM -0300, Marcelo Tosatti wrote: > > Upon closer investigation, it was found that in current codebase, lookup_bh_lru > > is slower than __find_get_block_slow: > > > > 114 ns per __find_get_block > > 68 ns per __find_get_block_slow > > > > So remove the per-CPU buffer_head caching. > > LOL. That's amazing. I can't even see why it's so expensive. The > local_irq_disable(), perhaps? Your test case is the best possible > one for lookup_bh_lru() where you're not even doing the copy. I think it's even simpler than that. i.e. the lookaside cache is being missed, so it's a pure cost and the code is always having to call __find_get_block_slow() anyway. Peeking at 16 buffers to not find a match is just as expensive as walking 3-4 tree levels in an Xarray to find the buffer in the first place.... IMO, this is an example of how lookaside caches are only a benefit if the working set of items largely fits in the lookaside cache and the cache lookup itself is much, much slower than a lookaside cache miss. Cheers, Dave. -- Dave Chinner david@fromorbit.com