Patch "sched/rt: Provide migrate_disable/enable() inlines" has been added to the 4.19-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    sched/rt: Provide migrate_disable/enable() inlines

to the 4.19-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     sched-rt-provide-migrate_disable-enable-inlines.patch
and it can be found in the queue-4.19 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit bb705ec5872f61f7aace38c77134b95069e8cc70
Author: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Date:   Sat Feb 8 20:48:29 2020 +0100

    sched/rt: Provide migrate_disable/enable() inlines
    
    [ Upstream commit 66630058e56b26b3a9cf2625e250a8c592dd0207 ]
    
    Code which solely needs to prevent migration of a task uses
    preempt_disable()/enable() pairs. This is the only reliable way to do so
    as setting the task affinity to a single CPU can be undone by a
    setaffinity operation from a different task/process.
    
    RT provides a seperate migrate_disable/enable() mechanism which does not
    disable preemption to achieve the semantic requirements of a (almost) fully
    preemptible kernel.
    
    As it is unclear from looking at a given code path whether the intention is
    to disable preemption or migration, introduce migrate_disable/enable()
    inline functions which can be used to annotate code which merely needs to
    disable migration. Map them to preempt_disable/enable() for now. The RT
    substitution will be provided later.
    
    Code which is annotated that way documents that it has no requirement to
    protect against reentrancy of a preempting task. Either this is not
    required at all or the call sites are already serialized by other means.
    
    Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
    Signed-off-by: Ingo Molnar <mingo@xxxxxxxxxx>
    Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
    Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
    Cc: Juri Lelli <juri.lelli@xxxxxxxxxx>
    Cc: Vincent Guittot <vincent.guittot@xxxxxxxxxx>
    Cc: Dietmar Eggemann <dietmar.eggemann@xxxxxxx>
    Cc: Steven Rostedt <rostedt@xxxxxxxxxxx>
    Cc: Ben Segall <bsegall@xxxxxxxxxx>
    Cc: Mel Gorman <mgorman@xxxxxxx>
    Cc: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/878slclv1u.fsf@xxxxxxxxxxxxxxxxxxxxxxx
    Stable-dep-of: 36c75ce3bd29 ("nd_btt: Make BTT lanes preemptible")
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/include/linux/preempt.h b/include/linux/preempt.h
index c01813c3fbe93..abeec72b4d359 100644
--- a/include/linux/preempt.h
+++ b/include/linux/preempt.h
@@ -325,4 +325,34 @@ static inline void preempt_notifier_init(struct preempt_notifier *notifier,
 
 #endif
 
+/**
+ * migrate_disable - Prevent migration of the current task
+ *
+ * Maps to preempt_disable() which also disables preemption. Use
+ * migrate_disable() to annotate that the intent is to prevent migration,
+ * but not necessarily preemption.
+ *
+ * Can be invoked nested like preempt_disable() and needs the corresponding
+ * number of migrate_enable() invocations.
+ */
+static __always_inline void migrate_disable(void)
+{
+	preempt_disable();
+}
+
+/**
+ * migrate_enable - Allow migration of the current task
+ *
+ * Counterpart to migrate_disable().
+ *
+ * As migrate_disable() can be invoked nested, only the outermost invocation
+ * reenables migration.
+ *
+ * Currently mapped to preempt_enable().
+ */
+static __always_inline void migrate_enable(void)
+{
+	preempt_enable();
+}
+
 #endif /* __LINUX_PREEMPT_H */



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux