[Linux-kernel-mentees] [PATCH] sched: Annotate perf_event_ctxp with __rcu

Amol Grover frextrite at gmail.com
Sat Feb 8 14:45:51 UTC 2020


perf_event_ctxp is used in RCU context in kernel/events/core.c,
tell sparse about it as well.

Fix the following instances of sparse error:
kernel/events/core.c:1384:15: error: incompatible types in comparison
kernel/events/core.c:1397:28: error: incompatible types in comparison
kernel/events/core.c:3264:25: error: incompatible types in comparison
kernel/events/core.c:3265:25: error: incompatible types in comparison
kernel/events/core.c:4340:25: error: incompatible types in comparison
kernel/events/core.c:7091:23: error: incompatible types in comparison
kernel/events/core.c:7870:23: error: incompatible types in comparison
kernel/events/core.c:8971:23: error: incompatible types in comparison
kernel/events/core.c:11865:9: error: incompatible types in comparison
kernel/events/core.c:11975:17: error: incompatible types in comparison

Signed-off-by: Amol Grover <frextrite at gmail.com>
---
 include/linux/sched.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index 716ad1d8d95e..5df1778cfdf4 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1063,7 +1063,7 @@ struct task_struct {
 	unsigned int			futex_state;
 #endif
 #ifdef CONFIG_PERF_EVENTS
-	struct perf_event_context	*perf_event_ctxp[perf_nr_task_contexts];
+	struct perf_event_context __rcu	*perf_event_ctxp[perf_nr_task_contexts];
 	struct mutex			perf_event_mutex;
 	struct list_head		perf_event_list;
 #endif
-- 
2.24.1



More information about the Linux-kernel-mentees mailing list