public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Frederic Weisbecker <frederic@kernel.org>
To: Marcelo Tosatti <mtosatti@redhat.com>
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	Alexander Viro <viro@zeniv.linux.org.uk>,
	Christian Brauner <brauner@kernel.org>,
	Matthew Wilcox <willy@infradead.org>,
	Christoph Hellwig <hch@lst.de>, Jens Axboe <axboe@kernel.dk>,
	Dave Chinner <david@fromorbit.com>,
	Valentin Schneider <vschneid@redhat.com>,
	Leonardo Bras <leobras@redhat.com>,
	Yair Podemsky <ypodemsk@redhat.com>, P J P <ppandit@redhat.com>
Subject: Re: [PATCH] fs/buffer.c: disable per-CPU buffer_head cache for isolated CPUs
Date: Thu, 10 Aug 2023 12:36:38 +0200	[thread overview]
Message-ID: <ZNS9tqX9s7NbQq3c@lothringen> (raw)
In-Reply-To: <ZM2PvQJd7kRyWnAZ@tpad>

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 <frederic@kernel.org>

Thanks!

  reply	other threads:[~2023-08-10 10:36 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-27 20:08 [PATCH] fs/buffer.c: disable per-CPU buffer_head cache for isolated CPUs Marcelo Tosatti
2023-07-26 14:31 ` Marcelo Tosatti
2023-07-27  9:18   ` Christian Brauner
2023-07-28 19:35     ` Marcelo Tosatti
2023-08-04 22:03 ` Frederic Weisbecker
2023-08-04 23:54   ` Marcelo Tosatti
2023-08-10 10:36     ` Frederic Weisbecker [this message]
2023-08-10 11:59 ` Christian Brauner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZNS9tqX9s7NbQq3c@lothringen \
    --to=frederic@kernel.org \
    --cc=axboe@kernel.dk \
    --cc=brauner@kernel.org \
    --cc=david@fromorbit.com \
    --cc=hch@lst.de \
    --cc=leobras@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=ppandit@redhat.com \
    --cc=viro@zeniv.linux.org.uk \
    --cc=vschneid@redhat.com \
    --cc=willy@infradead.org \
    --cc=ypodemsk@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox