[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250430133026.GH9140@suse.cz>
Date: Wed, 30 Apr 2025 15:30:26 +0200
From: David Sterba <dsterba@...e.cz>
To: Daniel Vacek <neelx@...e.com>
Cc: Chris Mason <clm@...com>, Josef Bacik <josef@...icpanda.com>,
David Sterba <dsterba@...e.com>, linux-btrfs@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] btrfs: remove extent buffer's redundant `len` member
field
On Wed, Apr 30, 2025 at 10:21:18AM +0200, Daniel Vacek wrote:
> > The benefit of duplicating the length in each eb is that it's in the
> > same cacheline as the other members that are used for offset
> > calculations or bit manipulations.
> >
> > Going to the fs_info->nodesize may or may not hit a cache, also because
> > it needs to do 2 pointer dereferences, so from that perspective I think
> > it's making it worse.
>
> I was considering that. Since fs_info is shared for all ebs and other
> stuff like transactions, etc. I think the cache is hot most of the
> time and there will be hardly any performance difference observable.
> Though without benchmarks this is just a speculation (on both sides).
The comparison is between "always access 1 cacheline" and "hope that the
other cacheline is hot", yeah we don't have benchmarks for that but the
first access pattern is not conditional.
> > I don't think we need to do the optimization right now, but maybe in the
> > future if there's a need to add something to eb. Still we can use the
> > remaining 16 bytes up to 256 without making things worse.
>
> This really depends on configuration. On my laptop (Debian -rt kernel)
> the eb struct is actually 272 bytes as the rt_mutex is significantly
> heavier than raw spin lock. And -rt is a first class citizen nowadays,
> often used in Kubernetes deployments like 5G RAN telco, dpdk and such.
> I think it would be nice to slim the struct below 256 bytes even there
> if that's your aim.
I configured and built RT kernel to see if it's possible to go to 256
bytes on RT and it seems yes with a big sacrifice of removing several
struct members that cache values like folio_size or folio_shift and
generating worse code.
As 272 is a multiple of 16 it's a reasonable size and we don't need to
optimize further. The number of ebs in one slab is 30, with the non-rt
build it's 34, which sounds OK.
Powered by blists - more mailing lists