From: David Sterba <dsterba@suse.cz>
To: Filipe Manana <fdmanana@kernel.org>
Cc: dsterba@suse.cz, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 7/8] btrfs: use a dedicated data structure for chunk maps
Date: Wed, 22 Nov 2023 15:16:11 +0100 [thread overview]
Message-ID: <20231122141611.GC11264@twin.jikos.cz> (raw)
In-Reply-To: <CAL3q7H5-H2czrYap6XEBJeGDVkKDHJdLt3wCyD0VHFuPjEfLgQ@mail.gmail.com>
On Wed, Nov 22, 2023 at 11:32:33AM +0000, Filipe Manana wrote:
> On Tue, Nov 21, 2023 at 6:30 PM David Sterba <dsterba@suse.cz> wrote:
> > On Tue, Nov 21, 2023 at 01:38:38PM +0000, fdmanana@kernel.org wrote:
> >
> > struct btrfs_chunk_map {
> > struct rb_node rb_node __attribute__((__aligned__(8))); /* 0 24 */
> > refcount_t refs; /* 24 4 */
> >
> > /* XXX 4 bytes hole, try to pack */
> >
> > u64 start; /* 32 8 */
> > u64 chunk_len; /* 40 8 */
> > u64 stripe_size; /* 48 8 */
> > u64 type; /* 56 8 */
> > /* --- cacheline 1 boundary (64 bytes) --- */
> > int io_align; /* 64 4 */
> > int io_width; /* 68 4 */
> > int num_stripes; /* 72 4 */
> > int sub_stripes; /* 76 4 */
> > int verified_stripes; /* 80 4 */
> >
> > /* XXX 4 bytes hole, try to pack */
> >
> > struct btrfs_io_stripe stripes[]; /* 88 0 */
> >
> > /* size: 88, cachelines: 2, members: 12 */
> > /* sum members: 80, holes: 2, sum holes: 8 */
> > /* forced alignments: 1 */
> > /* last cacheline: 24 bytes */
> > } __attribute__((__aligned__(8)));
> >
> > I could move verify_stripes after refs or move refs to start of the
> > second cacheline between type and io_align. I suspect some cache
> > bouncing could happen with refcount updates and tree traversal but it's
> > a speculation and I don't think the effects would be measurable.
>
> I would prefer to have verified_stripes in the first cache line, right
> below refs for example, so that
> everything needed for map lookups and insertions is in the same cache line.
Right, that makes sense.
> Do you want to squash such change in this patch? Or should I send it separately?
I'll do the change, thanks.
next prev parent reply other threads:[~2023-11-22 14:23 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-21 13:38 [PATCH 0/8] btrfs: add a btrfs_chunk_map structure and preparatory cleanups fdmanana
2023-11-21 13:38 ` [PATCH 1/8] btrfs: fix off-by-one when checking chunk map includes logical address fdmanana
2023-11-21 13:38 ` [PATCH 2/8] btrfs: make error messages more clear when getting a chunk map fdmanana
2023-11-21 13:38 ` [PATCH 3/8] btrfs: mark sanity checks when getting chunk map as unlikely fdmanana
2023-11-21 13:38 ` [PATCH 4/8] btrfs: split assert into two different asserts when removing block group fdmanana
2023-11-21 13:38 ` [PATCH 5/8] btrfs: unexport extent_map_block_end() fdmanana
2023-11-21 13:38 ` [PATCH 6/8] btrfs: use btrfs_next_item() at scrub.c:find_first_extent_item() fdmanana
2023-11-21 13:38 ` [PATCH 7/8] btrfs: use a dedicated data structure for chunk maps fdmanana
2023-11-21 15:19 ` David Sterba
2023-11-21 16:50 ` Filipe Manana
2023-11-21 18:08 ` David Sterba
2023-11-21 18:23 ` David Sterba
2023-11-22 11:32 ` Filipe Manana
2023-11-22 14:16 ` David Sterba [this message]
2023-11-21 21:25 ` kernel test robot
2023-11-21 13:38 ` [PATCH 8/8] btrfs: remove stripe size local variable from insert_dev_extents() fdmanana
2023-11-21 14:12 ` [PATCH 0/8] btrfs: add a btrfs_chunk_map structure and preparatory cleanups Josef Bacik
2023-11-21 21:03 ` David Sterba
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=20231122141611.GC11264@twin.jikos.cz \
--to=dsterba@suse.cz \
--cc=fdmanana@kernel.org \
--cc=linux-btrfs@vger.kernel.org \
/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