Skip to content

Commit 4dc94e1

Browse files
image-dragonKernel Patches Daemon
authored andcommitted
rcu: add rcu_migrate_enable and rcu_migrate_disable
migrate_disable() is called to disable migration in the kernel, and it is used togather with rcu_read_lock() oftenly. However, with PREEMPT_RCU disabled, it's unnecessary, as rcu_read_lock() will disable preemption, which will also disable migration. Introduce rcu_migrate_enable() and rcu_migrate_disable(), which will do the migration enable and disable only when the rcu_read_lock() can't do it. Signed-off-by: Menglong Dong <[email protected]>
1 parent 2530e45 commit 4dc94e1

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

include/linux/rcupdate.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,16 @@ static inline bool same_state_synchronize_rcu(unsigned long oldstate1, unsigned
7272
void __rcu_read_lock(void);
7373
void __rcu_read_unlock(void);
7474

75+
static inline void rcu_migrate_enable(void)
76+
{
77+
migrate_enable();
78+
}
79+
80+
static inline void rcu_migrate_disable(void)
81+
{
82+
migrate_disable();
83+
}
84+
7585
/*
7686
* Defined as a macro as it is a very low level header included from
7787
* areas that don't even know about current. This gives the rcu_read_lock()
@@ -105,6 +115,14 @@ static inline int rcu_preempt_depth(void)
105115
return 0;
106116
}
107117

118+
static inline void rcu_migrate_enable(void)
119+
{
120+
}
121+
122+
static inline void rcu_migrate_disable(void)
123+
{
124+
}
125+
108126
#endif /* #else #ifdef CONFIG_PREEMPT_RCU */
109127

110128
#ifdef CONFIG_RCU_LAZY

0 commit comments

Comments
 (0)