summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2022-11-23 23:06:12 -0500
committerKent Overstreet <kent.overstreet@linux.dev>2022-11-30 12:30:49 -0500
commit726e46df96bfe82126d8c88c0f25b1dda4bc3133 (patch)
tree9ab9ead67b97d3d2c08e998e3a2f4ae2ccc68edb
parenteee212b914fe85d8aed1e148973abe8ba7677121 (diff)
bcachefs: Cacheline align two sections of struct write_point
struct write_point has two sections now: one used by the allocator prior to write submission, and a list of pending ops used for processing btree updates after write completion. These two sections will be used by different threads and typically on different cores, thus cacheline aligning them is beneficial here. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
-rw-r--r--fs/bcachefs/alloc_types.h36
1 files changed, 20 insertions, 16 deletions
diff --git a/fs/bcachefs/alloc_types.h b/fs/bcachefs/alloc_types.h
index 271b4bf2b95e..330267346c63 100644
--- a/fs/bcachefs/alloc_types.h
+++ b/fs/bcachefs/alloc_types.h
@@ -76,22 +76,26 @@ struct dev_stripe_state {
};
struct write_point {
- struct hlist_node node;
- struct mutex lock;
- u64 last_used;
- unsigned long write_point;
- enum bch_data_type data_type;
-
- /* calculated based on how many pointers we're actually going to use: */
- unsigned sectors_free;
-
- struct open_buckets ptrs;
- struct dev_stripe_state stripe;
-
- struct work_struct index_update_work;
-
- struct list_head writes;
- spinlock_t writes_lock;
+ struct {
+ struct hlist_node node;
+ struct mutex lock;
+ u64 last_used;
+ unsigned long write_point;
+ enum bch_data_type data_type;
+
+ /* calculated based on how many pointers we're actually going to use: */
+ unsigned sectors_free;
+
+ struct open_buckets ptrs;
+ struct dev_stripe_state stripe;
+ } __attribute__((__aligned__(SMP_CACHE_BYTES)));
+
+ struct {
+ struct work_struct index_update_work;
+
+ struct list_head writes;
+ spinlock_t writes_lock;
+ } __attribute__((__aligned__(SMP_CACHE_BYTES)));
};
struct write_point_specifier {