sys_membarrier: Add expedited option
The sys_membarrier() system call has proven too slow for some use cases,
which has prompted users to instead rely on TLB shootdown. Although TLB
shootdown is much faster, it has the slight disadvantage of not working
at all on arm and arm64 and also of being vulnerable to reasonable
optimizations that might skip some IPIs. However, the Linux kernel
does not currrently provide a reasonable alternative, so it is hard to
criticize these users from doing what works for them on a given piece
of hardware at a given time.
This commit therefore adds an expedited option to the sys_membarrier()
system call, thus providing a faster mechanism that is portable and
is not subject to death by optimization. Note that if more than one
MEMBARRIER_CMD_SHARED_EXPEDITED sys_membarrier() call happens within
the same jiffy, all but the first will use synchronize_sched() instead
of synchronize_sched_expedited().
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
[ paulmck: Fix code style issue pointed out by Boqun Feng. ]
Tested-by: Avi Kivity <avi@scylladb.com>
Cc: Maged Michael <maged.michael@gmail.com>
Cc: Andrew Hunter <ahh@google.com>
Cc: Geoffrey Romer <gromer@google.com>
2 files changed