mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-24 05:50:53 +07:00
44656d3dc4
Add volatile current->state to list of implicitly atomic accesses. This is in preparation to eventually enable KCSAN on kernel/sched (which currently still has KCSAN_SANITIZE := n). Since accesses that match the special check in atomic.h are rare, it makes more sense to move this check to the slow-path, avoiding the additional compare in the fast-path. With the microbenchmark, a speedup of ~6% is measured. Signed-off-by: Marco Elver <elver@google.com> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
21 lines
608 B
C
21 lines
608 B
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
|
|
#ifndef _KERNEL_KCSAN_ATOMIC_H
|
|
#define _KERNEL_KCSAN_ATOMIC_H
|
|
|
|
#include <linux/jiffies.h>
|
|
#include <linux/sched.h>
|
|
|
|
/*
|
|
* Special rules for certain memory where concurrent conflicting accesses are
|
|
* common, however, the current convention is to not mark them; returns true if
|
|
* access to @ptr should be considered atomic. Called from slow-path.
|
|
*/
|
|
static bool kcsan_is_atomic_special(const volatile void *ptr)
|
|
{
|
|
/* volatile globals that have been observed in data races. */
|
|
return ptr == &jiffies || ptr == ¤t->state;
|
|
}
|
|
|
|
#endif /* _KERNEL_KCSAN_ATOMIC_H */
|