freebsd-dev/sys/security/mac
Mateusz Guzik 3ea3fbe685 vfs: fix vn_poll performance with either MAC or AUDIT
The code would unconditionally lock the vnode to audit or call the
mac hoook, even if neither want to do anything. Pre-check the state
to avoid locking in the common case of nothing to do.

Note this code should not be normally executed anyway as vnodes are
always return ready. However, poll1/2 from will-it-scale use regular
files for benchmarking, presumably to focus on the interface itself
as the vnode handler is not supposed to do almost anything.

This in particular fixes poll2 which passes 128 fds.

$ ./poll2_processes -s 10
before: 134411
after:  271572
2020-07-16 14:09:18 +00:00
..
mac_audit.c
mac_cred.c
mac_framework.c vfs: fix vn_poll performance with either MAC or AUDIT 2020-07-16 14:09:18 +00:00
mac_framework.h vfs: fix vn_poll performance with either MAC or AUDIT 2020-07-16 14:09:18 +00:00
mac_inet6.c
mac_inet.c
mac_internal.h
mac_label.c
mac_net.c
mac_pipe.c
mac_policy.h
mac_posix_sem.c
mac_posix_shm.c
mac_priv.c mac: implement fast path for checks 2020-02-13 22:19:17 +00:00
mac_process.c vfs: drop the mostly unused flags argument from VOP_UNLOCK 2020-01-03 22:29:58 +00:00
mac_socket.c
mac_syscalls.c vfs: drop the mostly unused flags argument from VOP_UNLOCK 2020-01-03 22:29:58 +00:00
mac_system.c
mac_sysv_msg.c
mac_sysv_sem.c
mac_sysv_shm.c
mac_vfs.c vfs: use mac fastpath for lookup, open, read, write, mmap 2020-02-13 22:22:55 +00:00