audit: unify audit_filter_{uring(), inode_name(), syscall()}
authorAnkur Arora <ankur.a.arora@oracle.com>
Fri, 7 Oct 2022 00:49:43 +0000 (17:49 -0700)
committerPaul Moore <paul@paul-moore.com>
Mon, 17 Oct 2022 18:24:42 +0000 (14:24 -0400)
commit50979953c0c41e929e5f955800da68e1bb24c7ab
tree5f100f0098106c9214414612db93937e142d2f7e
parent069545997510833281f45f83e097017b9fef19b7
audit: unify audit_filter_{uring(), inode_name(), syscall()}

audit_filter_uring(), audit_filter_inode_name() are substantially
similar to audit_filter_syscall(). Move the core logic to
__audit_filter_op() which can be parametrized for all three.

On a Skylakex system, getpid() latency (all results aggregated
across 12 boot cycles):

         Min     Mean    Median   Max      pstdev
         (ns)    (ns)    (ns)     (ns)

 -    196.63   207.86  206.60  230.98      (+- 3.92%)
 +    183.73   196.95  192.31  232.49    (+- 6.04%)

Performance counter stats for 'bin/getpid' (3 runs) go from:
    cycles               805.58  (  +-  4.11% )
    instructions        1654.11  (  +-   .05% )
    IPC                    2.06  (  +-  3.39% )
    branches             430.02  (  +-   .05% )
    branch-misses          1.55  (  +-  7.09% )
    L1-dcache-loads      440.01  (  +-   .09% )
    L1-dcache-load-misses  9.05  (  +- 74.03% )
to:
    cycles  765.37  (  +-  6.66% )
    instructions        1677.07  (  +-  0.04% )
    IPC            2.20  (  +-  5.90% )
    branches          431.10  (  +-  0.04% )
    branch-misses    1.60  (  +- 11.25% )
    L1-dcache-loads  521.04  (  +-  0.05% )
    L1-dcache-load-misses  6.92  (  +- 77.60% )

(Both aggregated over 12 boot cycles.)

The increased L1-dcache-loads are due to some intermediate values now
coming from the stack.

The improvement in cycles is due to a slightly denser loop (the list
parameter in the list_for_each_entry_rcu() exit check now comes from
a register rather than a constant as before.)

Signed-off-by: Ankur Arora <ankur.a.arora@oracle.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
kernel/auditsc.c