Commit 1f23262
bpf: Skip redundant IBPB in pack allocator
commit a23c1c5 upstream.
bpf_prog_pack_alloc() issues IBPB on all CPUs on every cBPF allocation,
even when reusing chunks from an existing pack where no new memory was
touched since the last IBPB.
Since IBPB on all CPUs is heavy, Dave Hansen suggested to track allocation
since last IBPB, and only issue IBPB at reuse for the chunks that have not
seen an IBPB since they were last freed.
Track per-pack whether an IBPB is needed via arch_flush_needed. Set it when
allocating a chunk, reset on IBPB flush. On reuse, conditionally issue the
flush. Since IBPB invalidates all BTB entries, clear the flag on all packs
after flushing.
Signed-off-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>1 parent 3b3b23c commit 1f23262
1 file changed
Lines changed: 14 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
851 | 851 | | |
852 | 852 | | |
853 | 853 | | |
| 854 | + | |
854 | 855 | | |
855 | 856 | | |
856 | 857 | | |
| |||
906 | 907 | | |
907 | 908 | | |
908 | 909 | | |
| 910 | + | |
| 911 | + | |
909 | 912 | | |
910 | 913 | | |
911 | 914 | | |
| |||
952 | 955 | | |
953 | 956 | | |
954 | 957 | | |
955 | | - | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
| 962 | + | |
956 | 963 | | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
957 | 967 | | |
958 | 968 | | |
959 | 969 | | |
| |||
991 | 1001 | | |
992 | 1002 | | |
993 | 1003 | | |
| 1004 | + | |
| 1005 | + | |
| 1006 | + | |
994 | 1007 | | |
995 | 1008 | | |
996 | 1009 | | |
| |||
0 commit comments