]> git.ipfire.org Git - thirdparty/systemd.git/commit
bpf: optimize device type access away most of the time
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 10 Nov 2019 12:19:51 +0000 (13:19 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 11 Nov 2019 14:14:02 +0000 (15:14 +0100)
commit00486578281bccbe36a6a447b3597d6bf8967933
tree86236e8a613a4d92bdfba34a8b10698859a0bff5
parent8ad08622d6f818f65e56b1e588221a4d546ab9bb
bpf: optimize device type access away most of the time

Most of the time, we specify the allowed access mode as "rwm", so the check
always trivially passes. In that case, skip the check.

The repeating part changes from:
   5: (55) if r2 != 0x2 goto pc+6
   6: (bc) w1 = w3
   7: (54) w1 &= 7
   8: (5d) if r1 != r3 goto pc+3
   9: (55) if r4 != 0x1 goto pc+2
  10: (55) if r5 != 0x3 goto pc+1
  11: (05) goto pc+8
to
   6: (55) if r2 != 0x2 goto pc+3
   7: (55) if r4 != 0x1 goto pc+2
   8: (55) if r5 != 0x3 goto pc+1
   9: (05) goto pc+40
src/core/bpf-devices.c