Joanne Koong
8845b4681b
bpf: Add alignment padding for "map_extra" + consolidate holes
This patch makes 2 changes regarding alignment padding
for the "map_extra" field.
1) In the kernel header, "map_extra" and "btf_value_type_id"
are rearranged to consolidate the hole.
Before:
struct bpf_map {
...
u32 max_entries; /* 36 4 */
u32 map_flags; /* 40 4 */
/* XXX 4 bytes hole, try to pack */
u64 map_extra; /* 48 8 */
int spin_lock_off; /* 56 4 */
int timer_off; /* 60 4 */
/* --- cacheline 1 boundary (64 bytes) --- */
u32 id; /* 64 4 */
int numa_node; /* 68 4 */
...
bool frozen; /* 117 1 */
/* XXX 10 bytes hole, try to pack */
/* --- cacheline 2 boundary (128 bytes) --- */
...
struct work_struct work; /* 144 72 */
/* --- cacheline 3 boundary (192 bytes) was 24 bytes ago --- */
struct mutex freeze_mutex; /* 216 144 */
/* --- cacheline 5 boundary (320 bytes) was 40 bytes ago --- */
u64 writecnt; /* 360 8 */
/* size: 384, cachelines: 6, members: 26 */
/* sum members: 354, holes: 2, sum holes: 14 */
/* padding: 16 */
/* forced alignments: 2, forced holes: 1, sum forced holes: 10 */
} __attribute__((__aligned__(64)));
After:
struct bpf_map {
...
u32 max_entries; /* 36 4 */
u64 map_extra; /* 40 8 */
u32 map_flags; /* 48 4 */
int spin_lock_off; /* 52 4 */
int timer_off; /* 56 4 */
u32 id; /* 60 4 */
/* --- cacheline 1 boundary (64 bytes) --- */
int numa_node; /* 64 4 */
...
bool frozen /* 113 1 */
/* XXX 14 bytes hole, try to pack */
/* --- cacheline 2 boundary (128 bytes) --- */
...
struct work_struct work; /* 144 72 */
/* --- cacheline 3 boundary (192 bytes) was 24 bytes ago --- */
struct mutex freeze_mutex; /* 216 144 */
/* --- cacheline 5 boundary (320 bytes) was 40 bytes ago --- */
u64 writecnt; /* 360 8 */
/* size: 384, cachelines: 6, members: 26 */
/* sum members: 354, holes: 1, sum holes: 14 */
/* padding: 16 */
/* forced alignments: 2, forced holes: 1, sum forced holes: 14 */
} __attribute__((__aligned__(64)));
2) Add alignment padding to the bpf_map_info struct
More details can be found in commit 36f9814a49 ("bpf: fix uapi hole
for 32 bit compat applications")
Signed-off-by: Joanne Koong <joannekoong@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Yonghong Song <yhs@fb.com>
Link: https://lore.kernel.org/bpf/20211029224909.1721024-3-joannekoong@fb.com
2021-11-01 14:16:03 -07:00
..
2021-09-14 08:46:08 +02:00
2021-08-04 12:11:52 +02:00
2021-09-13 14:51:10 -05:00
2021-08-23 09:49:09 -07:00
2021-03-11 20:47:05 +00:00
2021-09-03 16:20:37 -07:00
2021-08-17 11:47:53 -04:00
2021-06-16 17:47:53 +02:00
2021-07-28 13:19:31 +01:00
2021-03-18 09:02:27 +01:00
2021-02-09 10:58:19 +01:00
2021-06-10 20:59:05 -04:00
2021-05-19 11:40:15 +02:00
2021-02-06 09:22:10 +01:00
2021-02-06 09:22:10 +01:00
2021-02-15 18:28:30 +01:00
2021-04-02 11:18:30 -06:00
2021-11-01 14:16:03 -07:00
2021-10-18 18:35:36 -07:00
2021-08-23 13:19:09 +02:00
2021-08-23 13:19:09 +02:00
2021-05-27 09:42:21 +02:00
2021-07-12 15:17:47 -05:00
2021-06-02 14:08:09 +02:00
2021-07-12 09:16:29 +02:00
2021-09-07 11:39:01 -07:00
2021-10-01 14:28:55 +01:00
2021-08-10 13:32:40 -04:00
2021-06-17 21:46:37 +02:00
2021-03-18 17:03:54 +01:00
2021-04-13 17:31:44 +01:00
2021-08-24 07:38:28 -07:00
2021-08-16 15:12:13 -07:00
2021-08-10 13:08:49 +02:00
2021-04-20 08:59:03 -06:00
2021-02-26 09:41:03 -08:00
2021-08-02 13:37:28 -06:00
2021-02-07 14:51:19 -08:00
2021-06-22 09:15:35 +02:00
2021-06-22 16:42:09 +02:00
2021-02-08 13:01:24 +01:00
2021-02-15 11:43:33 +01:00
2021-02-04 09:29:57 -08:00
2021-06-03 15:31:34 -07:00
2021-03-30 13:29:39 -07:00
2021-08-29 19:14:20 +05:30
2021-07-29 15:06:50 +01:00
2021-05-07 00:26:34 -07:00
2021-08-20 15:00:35 +01:00
2021-07-29 15:06:50 +01:00
2021-03-10 12:45:16 -08:00
2021-08-27 17:29:18 -07:00
2021-02-04 09:29:57 -08:00
2021-07-21 08:14:33 -07:00
2021-08-05 11:46:42 +01:00
2021-05-05 14:31:05 +02:00
2021-02-26 09:41:03 -08:00
2021-09-13 10:38:13 -06:00
2021-07-21 08:14:33 -07:00
2021-10-04 12:53:35 +01:00
2021-07-21 08:14:33 -07:00
2021-03-18 11:42:46 +01:00
2021-08-18 07:23:15 -06:00
2021-07-21 08:14:33 -07:00
2021-04-26 08:25:20 -07:00
2021-08-06 16:12:32 -04:00
2021-06-17 14:25:39 -04:00
2021-08-20 16:06:32 -04:00
2021-03-03 16:55:02 -08:00
2021-04-22 12:22:11 -07:00
2021-05-21 15:03:50 +02:00
2021-07-21 08:14:33 -07:00
2021-07-08 11:48:21 -07:00
2021-03-10 09:34:06 +01:00
2021-03-24 08:26:29 +01:00
2021-07-29 15:06:50 +01:00
2021-04-08 13:15:33 -07:00
2021-09-03 09:58:17 -07:00
2021-07-26 14:45:18 +02:00
2021-09-18 14:20:01 +01:00
2021-06-30 15:34:04 -06:00
2021-08-10 11:29:39 -07:00
2021-07-01 13:08:18 -07:00
2021-06-18 13:02:45 -07:00
2021-06-10 12:51:33 -07:00
2021-03-11 16:12:59 -08:00
2021-05-07 00:26:34 -07:00
2021-08-13 09:50:24 +02:00
2021-08-17 11:58:21 +02:00
2021-07-27 11:48:42 +01:00
2021-07-06 10:37:46 -05:00
2021-05-21 06:12:52 -10:00
2021-08-02 10:24:38 +01:00
2021-09-04 10:49:46 +01:00
2021-09-01 15:04:29 -07:00
2021-03-25 15:31:22 -07:00
2021-03-17 16:15:39 +01:00
2021-04-08 10:14:45 +02:00
2021-04-06 10:29:56 +02:00
2021-03-17 14:16:26 -05:00
2021-03-24 16:31:23 -07:00
2021-06-22 11:28:51 -07:00
2021-06-28 12:49:52 -07:00
2021-06-18 11:35:47 -07:00
2021-07-27 12:05:46 +02:00
2021-03-10 09:34:06 +01:00
2021-05-18 16:20:54 -05:00
2021-09-14 12:49:10 +01:00
2021-06-23 12:56:08 -07:00
2021-08-04 12:52:03 +01:00
2021-08-03 07:27:42 -04:00
2021-02-11 18:25:05 -08:00
2021-02-02 14:50:15 +01:00
2021-03-11 12:13:08 +01:00
2021-09-16 14:36:26 +01:00
2021-04-10 10:36:34 +02:00
2021-06-30 20:47:27 -07:00
2021-03-22 10:24:07 +01:00
2021-08-04 14:43:52 +02:00
2021-03-22 10:22:22 +01:00
2021-02-23 07:52:56 -05:00
2021-09-06 07:20:58 -04:00
2021-05-05 10:19:41 -06:00
2021-05-23 19:21:31 +02:00
2021-04-08 12:26:34 +02:00
2021-08-31 11:07:05 +02:00
2021-08-19 21:21:19 +02:00
2021-09-11 14:48:42 -07:00
2021-08-26 22:28:03 +02:00
2021-08-05 10:24:08 +01:00
2021-03-07 09:07:16 +01:00
2021-09-05 16:23:09 -04:00
2021-06-12 13:16:45 -07:00
2021-07-29 08:04:10 +02:00