1 // SPDX-License-Identifier: GPL-2.0 2 // Copyright (c) 2019 Facebook 3 #include "vmlinux.h" 4 #include <bpf/bpf_helpers.h> 5 #include <bpf/bpf_tracing.h> 6 7 char _license[] SEC("license") = "GPL"; 8 9 SEC("raw_tracepoint/kfree_skb") 10 int nested_loops(volatile struct pt_regs* ctx) 11 { 12 int i, j, sum = 0, m; 13 14 for (j = 0; j < 300; j++) 15 for (i = 0; i < j; i++) { 16 if (j & 1) 17 m = PT_REGS_RC(ctx); 18 else 19 m = j; 20 sum += i * m; 21 } 22 23 return sum; 24 } 25