[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231216033552.3553579-7-kent.overstreet@linux.dev>
Date: Fri, 15 Dec 2023 22:35:51 -0500
From: Kent Overstreet <kent.overstreet@...ux.dev>
To: linux-kernel@...r.kernel.org,
linux-mm@...ck.org,
linux-fsdevel@...r.kernel.org
Cc: Kent Overstreet <kent.overstreet@...ux.dev>,
tglx@...utronix.de,
x86@...nel.org,
tj@...nel.org,
peterz@...radead.org,
mathieu.desnoyers@...icios.com,
paulmck@...nel.org,
keescook@...omium.org,
dave.hansen@...ux.intel.com,
mingo@...hat.com,
will@...nel.org,
longman@...hat.com,
boqun.feng@...il.com,
brauner@...nel.org
Subject: [PATCH 50/50] Kill sched.h dependency on rcupdate.h
by moving cond_resched_rcu() to rcupdate.h, we can kill another big
sched.h dependency.
Signed-off-by: Kent Overstreet <kent.overstreet@...ux.dev>
---
include/linux/rcupdate.h | 11 +++++++++++
include/linux/sched.h | 13 +++----------
2 files changed, 14 insertions(+), 10 deletions(-)
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index f7206b2623c9..8ebfa57e0164 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -1058,4 +1058,15 @@ extern int rcu_normal;
DEFINE_LOCK_GUARD_0(rcu, rcu_read_lock(), rcu_read_unlock())
+#if defined(CONFIG_DEBUG_ATOMIC_SLEEP) || !defined(CONFIG_PREEMPT_RCU)
+#define cond_resched_rcu() \
+do { \
+ rcu_read_unlock(); \
+ cond_resched(); \
+ rcu_read_lock(); \
+} while (0)
+#else
+#define cond_resched_rcu()
+#endif
+
#endif /* __LINUX_RCUPDATE_H */
diff --git a/include/linux/sched.h b/include/linux/sched.h
index d528057c99e4..b781ac7e0a02 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -10,8 +10,11 @@
#include <uapi/linux/sched.h>
#include <asm/current.h>
+#include <linux/thread_info.h>
+#include <linux/preempt.h>
#include <linux/irqflags_types.h>
+#include <linux/smp_types.h>
#include <linux/pid_types.h>
#include <linux/sem_types.h>
#include <linux/shm.h>
@@ -22,7 +25,6 @@
#include <linux/timer_types.h>
#include <linux/seccomp_types.h>
#include <linux/nodemask_types.h>
-#include <linux/rcupdate.h>
#include <linux/refcount_types.h>
#include <linux/resource.h>
#include <linux/latencytop.h>
@@ -2058,15 +2060,6 @@ extern int __cond_resched_rwlock_write(rwlock_t *lock);
__cond_resched_rwlock_write(lock); \
})
-static inline void cond_resched_rcu(void)
-{
-#if defined(CONFIG_DEBUG_ATOMIC_SLEEP) || !defined(CONFIG_PREEMPT_RCU)
- rcu_read_unlock();
- cond_resched();
- rcu_read_lock();
-#endif
-}
-
#ifdef CONFIG_PREEMPT_DYNAMIC
extern bool preempt_model_none(void);
--
2.43.0
Powered by blists - more mailing lists