From 944974b4854e3f274e1beaa8165765eb385d8558 Mon Sep 17 00:00:00 2001 From: David Sterba Date: Mon, 9 Apr 2018 17:42:40 +0200 Subject: [PATCH] btrfs-progs: reorder extent buffer members for better packing Afther the fs_info was added, the size was over 128 bytes but we still have 8 bytes of holes, so with minor reordering we get back to that size. Before: struct extent_buffer { struct cache_extent cache_node; /* 0 48 */ u64 start; /* 48 8 */ u64 dev_bytenr; /* 56 8 */ /* --- cacheline 1 boundary (64 bytes) --- */ u32 len; /* 64 4 */ /* XXX 4 bytes hole, try to pack */ struct extent_io_tree * tree; /* 72 8 */ struct list_head lru; /* 80 16 */ struct list_head recow; /* 96 16 */ int refs; /* 112 4 */ u32 flags; /* 116 4 */ int fd; /* 120 4 */ /* XXX 4 bytes hole, try to pack */ /* --- cacheline 2 boundary (128 bytes) --- */ struct btrfs_fs_info * fs_info; /* 128 8 */ char data[0]; /* 136 0 */ /* size: 136, cachelines: 3, members: 12 */ /* sum members: 128, holes: 2, sum holes: 8 */ /* last cacheline: 8 bytes */ }; After: struct extent_buffer { struct cache_extent cache_node; /* 0 48 */ u64 start; /* 48 8 */ u64 dev_bytenr; /* 56 8 */ /* --- cacheline 1 boundary (64 bytes) --- */ struct extent_io_tree * tree; /* 64 8 */ struct list_head lru; /* 72 16 */ struct list_head recow; /* 88 16 */ u32 len; /* 104 4 */ int refs; /* 108 4 */ u32 flags; /* 112 4 */ int fd; /* 116 4 */ struct btrfs_fs_info * fs_info; /* 120 8 */ /* --- cacheline 2 boundary (128 bytes) --- */ char data[0]; /* 128 0 */ /* size: 128, cachelines: 2, members: 12 */ }; Signed-off-by: David Sterba --- extent_io.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extent_io.h b/extent_io.h index f8f7308..d407d93 100644 --- a/extent_io.h +++ b/extent_io.h @@ -91,10 +91,10 @@ struct extent_buffer { struct cache_extent cache_node; u64 start; u64 dev_bytenr; - u32 len; struct extent_io_tree *tree; struct list_head lru; struct list_head recow; + u32 len; int refs; u32 flags; int fd; -- 2.7.4