From mboxrd@z Thu Jan 1 00:00:00 1970 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 59B7BC04A94 for ; Thu, 10 Aug 2023 10:36:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234042AbjHJKgo (ORCPT ); Thu, 10 Aug 2023 06:36:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231213AbjHJKgn (ORCPT ); Thu, 10 Aug 2023 06:36:43 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D0DAEF2; Thu, 10 Aug 2023 03:36:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6E3FD63B15; Thu, 10 Aug 2023 10:36:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 50214C433C8; Thu, 10 Aug 2023 10:36:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1691663801; bh=7STLk6rer7/WorIAWuagccGXb4zGN98HldySsPD3+No=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=aOqymy5dDQqmV9rwAQp+pXXD+NaZr6GDNhX/UT9tK6WVqRjj4OV9iyu4J9kCV1Qlj WN0MZjoZ0V8KAyYHdK7UwKO+kpDIWABFo7rM/yqA5kM59kTLHBSujtWEJnFKLnXsj9 x9Xk7/lFdAFfAbq+8aCLM8F6CHBJNVoTjKxpqqavQuyBpsV+7kAaF/Eipd+7fe56T6 QmO40r3DpfMHZ+Puz+zSCSv0Lh3nv9qtY1mo5pxYKe3VRalw8FgcQcVETvdhtS9ktO VtaRip1Aa2lVui1QNDmC0JIxMOUS4sjhCqNOYPcrnjjf/mvHQV4EJynaV3zYlSu3yt j3IfyzHH8EReQ== Date: Thu, 10 Aug 2023 12:36:38 +0200 From: Frederic Weisbecker To: Marcelo Tosatti Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Alexander Viro , Christian Brauner , Matthew Wilcox , Christoph Hellwig , Jens Axboe , Dave Chinner , Valentin Schneider , Leonardo Bras , Yair Podemsky , P J P Subject: Re: [PATCH] fs/buffer.c: disable per-CPU buffer_head cache for isolated CPUs Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 04, 2023 at 08:54:37PM -0300, Marcelo Tosatti wrote: > > So what happens if they ever do I/O then? Like if they need to do > > some prep work before entering an isolated critical section? > > Then instead of going through the per-CPU LRU buffer_head cache > (__find_get_block), isolated CPUs will work as if their per-CPU > cache is always empty, going through the slowpath > (__find_get_block_slow). The algorithm is: > > /* > * Perform a pagecache lookup for the matching buffer. If it's there, refresh > * it in the LRU and mark it as accessed. If it is not present then return > * NULL > */ > struct buffer_head * > __find_get_block(struct block_device *bdev, sector_t block, unsigned size) > { > struct buffer_head *bh = lookup_bh_lru(bdev, block, size); > > if (bh == NULL) { > /* __find_get_block_slow will mark the page accessed */ > bh = __find_get_block_slow(bdev, block); > if (bh) > bh_lru_install(bh); > } else > touch_buffer(bh); > > return bh; > } > EXPORT_SYMBOL(__find_get_block); > > I think the performance difference between the per-CPU LRU cache > VS __find_get_block_slow was much more significant when the cache > was introduced. Nowadays its only 26ns (moreover modern filesystems > do not use buffer_head's). Sounds good then! Acked-by: Frederic Weisbecker Thanks!