File tree Expand file tree Collapse file tree 2 files changed +11
-4
lines changed
tools/testing/selftests/bpf/progs Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -299,7 +299,11 @@ int __on_event(struct bpf_raw_tracepoint_args *ctx)
299
299
#ifdef NO_UNROLL
300
300
#pragma clang loop unroll(disable)
301
301
#else
302
+ #ifdef UNROLL_COUNT
303
+ #pragma clang loop unroll_count(UNROLL_COUNT)
304
+ #else
302
305
#pragma clang loop unroll(full)
306
+ #endif
303
307
#endif /* NO_UNROLL */
304
308
/* Unwind python stack */
305
309
for (int i = 0 ; i < STACK_MAX_LEN ; ++ i ) {
Original file line number Diff line number Diff line change 1
1
// SPDX-License-Identifier: GPL-2.0
2
2
// Copyright (c) 2019 Facebook
3
3
#define STACK_MAX_LEN 600
4
- /* clang will not unroll the loop 600 times.
5
- * Instead it will unroll it to the amount it deemed
6
- * appropriate, but the loop will still execute 600 times.
7
- * Total program size is around 90k insns
4
+ /* Full unroll of 600 iterations will have total
5
+ * program size close to 298k insns and this may
6
+ * cause BPF_JMP insn out of 16-bit integer range.
7
+ * So limit the unroll size to 150 so the
8
+ * total program size is around 80k insns but
9
+ * the loop will still execute 600 times.
8
10
*/
11
+ #define UNROLL_COUNT 150
9
12
#include "pyperf.h"
You can’t perform that action at this time.
0 commit comments