aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests
diff options
context:
space:
mode:
authorMagnus Karlsson <magnus.karlsson@intel.com>2019-04-16 14:58:12 +0200
committerAlexei Starovoitov <ast@kernel.org>2019-04-16 20:13:10 -0700
commit2c5935f1b2b642cee8e1562396ec8a7781fc4c6d (patch)
tree851eb8e92dd057e389e6a7b733dbda56f8a1d666 /tools/testing/selftests
parentlibbpf: remove dependency on barrier.h in xsk.h (diff)
downloadlinux-dev-2c5935f1b2b642cee8e1562396ec8a7781fc4c6d.tar.xz
linux-dev-2c5935f1b2b642cee8e1562396ec8a7781fc4c6d.zip
libbpf: optimize barrier for XDP socket rings
The full memory barrier in the XDP socket rings on the consumer side between the load of the data and the store of the consumer ring is there to protect the store from being executed before the load of the data. If this was allowed to happen, the producer might overwrite the data field with a new entry before the consumer got the chance to read it. On x86, stores are guaranteed not to be reordered with older loads, so it does not need a full memory barrier here. A compile time barrier would be enough. This patch introdcues a new primitive in libbpf_util.h that implements a new barrier type (libbpf_smp_rwmb) hindering stores to be reordered with older loads. It is then used in the XDP socket ring access code in libbpf to improve performance. Signed-off-by: Magnus Karlsson <magnus.karlsson@intel.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/testing/selftests')
0 files changed, 0 insertions, 0 deletions