@@ -17,7 +17,7 @@ struct generic_map_value {
17
17
18
18
char _license [] SEC ("license" ) = "GPL" ;
19
19
20
- const unsigned int data_sizes [] = {8 , 16 , 32 , 64 , 96 , 128 , 192 , 256 , 512 , 1024 , 2048 , 4096 };
20
+ const unsigned int data_sizes [] = {16 , 32 , 64 , 96 , 128 , 192 , 256 , 512 , 1024 , 2048 , 4096 };
21
21
const volatile unsigned int data_btf_ids [ARRAY_SIZE (data_sizes )] = {};
22
22
23
23
int err = 0 ;
@@ -166,7 +166,7 @@ static __always_inline void batch_percpu_free(struct bpf_map *map, unsigned int
166
166
batch_percpu_free((struct bpf_map *)(&array_percpu_##size), batch, idx); \
167
167
} while (0)
168
168
169
- DEFINE_ARRAY_WITH_KPTR ( 8 );
169
+ /* kptr doesn't support bin_data_8 which is a zero-sized array */
170
170
DEFINE_ARRAY_WITH_KPTR (16 );
171
171
DEFINE_ARRAY_WITH_KPTR (32 );
172
172
DEFINE_ARRAY_WITH_KPTR (64 );
@@ -198,21 +198,20 @@ int test_batch_alloc_free(void *ctx)
198
198
if ((u32 )bpf_get_current_pid_tgid () != pid )
199
199
return 0 ;
200
200
201
- /* Alloc 128 8 -bytes objects in batch to trigger refilling,
202
- * then free 128 8 -bytes objects in batch to trigger freeing.
201
+ /* Alloc 128 16 -bytes objects in batch to trigger refilling,
202
+ * then free 128 16 -bytes objects in batch to trigger freeing.
203
203
*/
204
- CALL_BATCH_ALLOC_FREE (8 , 128 , 0 );
205
- CALL_BATCH_ALLOC_FREE (16 , 128 , 1 );
206
- CALL_BATCH_ALLOC_FREE (32 , 128 , 2 );
207
- CALL_BATCH_ALLOC_FREE (64 , 128 , 3 );
208
- CALL_BATCH_ALLOC_FREE (96 , 128 , 4 );
209
- CALL_BATCH_ALLOC_FREE (128 , 128 , 5 );
210
- CALL_BATCH_ALLOC_FREE (192 , 128 , 6 );
211
- CALL_BATCH_ALLOC_FREE (256 , 128 , 7 );
212
- CALL_BATCH_ALLOC_FREE (512 , 64 , 8 );
213
- CALL_BATCH_ALLOC_FREE (1024 , 32 , 9 );
214
- CALL_BATCH_ALLOC_FREE (2048 , 16 , 10 );
215
- CALL_BATCH_ALLOC_FREE (4096 , 8 , 11 );
204
+ CALL_BATCH_ALLOC_FREE (16 , 128 , 0 );
205
+ CALL_BATCH_ALLOC_FREE (32 , 128 , 1 );
206
+ CALL_BATCH_ALLOC_FREE (64 , 128 , 2 );
207
+ CALL_BATCH_ALLOC_FREE (96 , 128 , 3 );
208
+ CALL_BATCH_ALLOC_FREE (128 , 128 , 4 );
209
+ CALL_BATCH_ALLOC_FREE (192 , 128 , 5 );
210
+ CALL_BATCH_ALLOC_FREE (256 , 128 , 6 );
211
+ CALL_BATCH_ALLOC_FREE (512 , 64 , 7 );
212
+ CALL_BATCH_ALLOC_FREE (1024 , 32 , 8 );
213
+ CALL_BATCH_ALLOC_FREE (2048 , 16 , 9 );
214
+ CALL_BATCH_ALLOC_FREE (4096 , 8 , 10 );
216
215
217
216
return 0 ;
218
217
}
@@ -223,21 +222,20 @@ int test_free_through_map_free(void *ctx)
223
222
if ((u32 )bpf_get_current_pid_tgid () != pid )
224
223
return 0 ;
225
224
226
- /* Alloc 128 8 -bytes objects in batch to trigger refilling,
225
+ /* Alloc 128 16 -bytes objects in batch to trigger refilling,
227
226
* then free these objects through map free.
228
227
*/
229
- CALL_BATCH_ALLOC (8 , 128 , 0 );
230
- CALL_BATCH_ALLOC (16 , 128 , 1 );
231
- CALL_BATCH_ALLOC (32 , 128 , 2 );
232
- CALL_BATCH_ALLOC (64 , 128 , 3 );
233
- CALL_BATCH_ALLOC (96 , 128 , 4 );
234
- CALL_BATCH_ALLOC (128 , 128 , 5 );
235
- CALL_BATCH_ALLOC (192 , 128 , 6 );
236
- CALL_BATCH_ALLOC (256 , 128 , 7 );
237
- CALL_BATCH_ALLOC (512 , 64 , 8 );
238
- CALL_BATCH_ALLOC (1024 , 32 , 9 );
239
- CALL_BATCH_ALLOC (2048 , 16 , 10 );
240
- CALL_BATCH_ALLOC (4096 , 8 , 11 );
228
+ CALL_BATCH_ALLOC (16 , 128 , 0 );
229
+ CALL_BATCH_ALLOC (32 , 128 , 1 );
230
+ CALL_BATCH_ALLOC (64 , 128 , 2 );
231
+ CALL_BATCH_ALLOC (96 , 128 , 3 );
232
+ CALL_BATCH_ALLOC (128 , 128 , 4 );
233
+ CALL_BATCH_ALLOC (192 , 128 , 5 );
234
+ CALL_BATCH_ALLOC (256 , 128 , 6 );
235
+ CALL_BATCH_ALLOC (512 , 64 , 7 );
236
+ CALL_BATCH_ALLOC (1024 , 32 , 8 );
237
+ CALL_BATCH_ALLOC (2048 , 16 , 9 );
238
+ CALL_BATCH_ALLOC (4096 , 8 , 10 );
241
239
242
240
return 0 ;
243
241
}
@@ -251,17 +249,17 @@ int test_batch_percpu_alloc_free(void *ctx)
251
249
/* Alloc 128 16-bytes per-cpu objects in batch to trigger refilling,
252
250
* then free 128 16-bytes per-cpu objects in batch to trigger freeing.
253
251
*/
254
- CALL_BATCH_PERCPU_ALLOC_FREE (16 , 128 , 1 );
255
- CALL_BATCH_PERCPU_ALLOC_FREE (32 , 128 , 2 );
256
- CALL_BATCH_PERCPU_ALLOC_FREE (64 , 128 , 3 );
257
- CALL_BATCH_PERCPU_ALLOC_FREE (96 , 128 , 4 );
258
- CALL_BATCH_PERCPU_ALLOC_FREE (128 , 128 , 5 );
259
- CALL_BATCH_PERCPU_ALLOC_FREE (192 , 128 , 6 );
260
- CALL_BATCH_PERCPU_ALLOC_FREE (256 , 128 , 7 );
261
- CALL_BATCH_PERCPU_ALLOC_FREE (512 , 64 , 8 );
262
- CALL_BATCH_PERCPU_ALLOC_FREE (1024 , 32 , 9 );
263
- CALL_BATCH_PERCPU_ALLOC_FREE (2048 , 16 , 10 );
264
- CALL_BATCH_PERCPU_ALLOC_FREE (4096 , 8 , 11 );
252
+ CALL_BATCH_PERCPU_ALLOC_FREE (16 , 128 , 0 );
253
+ CALL_BATCH_PERCPU_ALLOC_FREE (32 , 128 , 1 );
254
+ CALL_BATCH_PERCPU_ALLOC_FREE (64 , 128 , 2 );
255
+ CALL_BATCH_PERCPU_ALLOC_FREE (96 , 128 , 3 );
256
+ CALL_BATCH_PERCPU_ALLOC_FREE (128 , 128 , 4 );
257
+ CALL_BATCH_PERCPU_ALLOC_FREE (192 , 128 , 5 );
258
+ CALL_BATCH_PERCPU_ALLOC_FREE (256 , 128 , 6 );
259
+ CALL_BATCH_PERCPU_ALLOC_FREE (512 , 64 , 7 );
260
+ CALL_BATCH_PERCPU_ALLOC_FREE (1024 , 32 , 8 );
261
+ CALL_BATCH_PERCPU_ALLOC_FREE (2048 , 16 , 9 );
262
+ CALL_BATCH_PERCPU_ALLOC_FREE (4096 , 8 , 10 );
265
263
266
264
return 0 ;
267
265
}
@@ -275,17 +273,17 @@ int test_percpu_free_through_map_free(void *ctx)
275
273
/* Alloc 128 16-bytes per-cpu objects in batch to trigger refilling,
276
274
* then free these object through map free.
277
275
*/
278
- CALL_BATCH_PERCPU_ALLOC (16 , 128 , 1 );
279
- CALL_BATCH_PERCPU_ALLOC (32 , 128 , 2 );
280
- CALL_BATCH_PERCPU_ALLOC (64 , 128 , 3 );
281
- CALL_BATCH_PERCPU_ALLOC (96 , 128 , 4 );
282
- CALL_BATCH_PERCPU_ALLOC (128 , 128 , 5 );
283
- CALL_BATCH_PERCPU_ALLOC (192 , 128 , 6 );
284
- CALL_BATCH_PERCPU_ALLOC (256 , 128 , 7 );
285
- CALL_BATCH_PERCPU_ALLOC (512 , 64 , 8 );
286
- CALL_BATCH_PERCPU_ALLOC (1024 , 32 , 9 );
287
- CALL_BATCH_PERCPU_ALLOC (2048 , 16 , 10 );
288
- CALL_BATCH_PERCPU_ALLOC (4096 , 8 , 11 );
276
+ CALL_BATCH_PERCPU_ALLOC (16 , 128 , 0 );
277
+ CALL_BATCH_PERCPU_ALLOC (32 , 128 , 1 );
278
+ CALL_BATCH_PERCPU_ALLOC (64 , 128 , 2 );
279
+ CALL_BATCH_PERCPU_ALLOC (96 , 128 , 3 );
280
+ CALL_BATCH_PERCPU_ALLOC (128 , 128 , 4 );
281
+ CALL_BATCH_PERCPU_ALLOC (192 , 128 , 5 );
282
+ CALL_BATCH_PERCPU_ALLOC (256 , 128 , 6 );
283
+ CALL_BATCH_PERCPU_ALLOC (512 , 64 , 7 );
284
+ CALL_BATCH_PERCPU_ALLOC (1024 , 32 , 8 );
285
+ CALL_BATCH_PERCPU_ALLOC (2048 , 16 , 9 );
286
+ CALL_BATCH_PERCPU_ALLOC (4096 , 8 , 10 );
289
287
290
288
return 0 ;
291
289
}
0 commit comments