368 lines
13 KiB
Diff
368 lines
13 KiB
Diff
diff --git a/arch/arm/include/asm/mmu_context.h b/arch/arm/include/asm/mmu_context.h
|
|
--- a/arch/arm/include/asm/mmu_context.h
|
|
+++ b/arch/arm/include/asm/mmu_context.h
|
|
@@ -80,7 +80,7 @@ static inline void check_and_switch_context(struct mm_struct *mm,
|
|
#ifndef MODULE
|
|
#define finish_arch_post_lock_switch \
|
|
finish_arch_post_lock_switch
|
|
-static inline void finish_arch_post_lock_switch(void)
|
|
+static __always_inline void finish_arch_post_lock_switch(void)
|
|
{
|
|
struct mm_struct *mm = current->mm;
|
|
|
|
diff --git a/arch/riscv/include/asm/sync_core.h b/arch/riscv/include/asm/sync_core.h
|
|
--- a/arch/riscv/include/asm/sync_core.h
|
|
+++ b/arch/riscv/include/asm/sync_core.h
|
|
@@ -6,7 +6,7 @@
|
|
* RISC-V implements return to user-space through an xRET instruction,
|
|
* which is not core serializing.
|
|
*/
|
|
-static inline void sync_core_before_usermode(void)
|
|
+static __always_inline void sync_core_before_usermode(void)
|
|
{
|
|
asm volatile ("fence.i" ::: "memory");
|
|
}
|
|
diff --git a/arch/s390/include/asm/mmu_context.h b/arch/s390/include/asm/mmu_context.h
|
|
--- a/arch/s390/include/asm/mmu_context.h
|
|
+++ b/arch/s390/include/asm/mmu_context.h
|
|
@@ -93,7 +93,7 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
|
|
}
|
|
|
|
#define finish_arch_post_lock_switch finish_arch_post_lock_switch
|
|
-static inline void finish_arch_post_lock_switch(void)
|
|
+static __always_inline void finish_arch_post_lock_switch(void)
|
|
{
|
|
struct task_struct *tsk = current;
|
|
struct mm_struct *mm = tsk->mm;
|
|
diff --git a/arch/sparc/include/asm/mmu_context_64.h b/arch/sparc/include/asm/mmu_context_64.h
|
|
--- a/arch/sparc/include/asm/mmu_context_64.h
|
|
+++ b/arch/sparc/include/asm/mmu_context_64.h
|
|
@@ -160,7 +160,7 @@ static inline void arch_start_context_switch(struct task_struct *prev)
|
|
}
|
|
|
|
#define finish_arch_post_lock_switch finish_arch_post_lock_switch
|
|
-static inline void finish_arch_post_lock_switch(void)
|
|
+static __always_inline void finish_arch_post_lock_switch(void)
|
|
{
|
|
/* Restore the state of MCDPER register for the new process
|
|
* just switched to.
|
|
diff --git a/arch/x86/include/asm/sync_core.h b/arch/x86/include/asm/sync_core.h
|
|
--- a/arch/x86/include/asm/sync_core.h
|
|
+++ b/arch/x86/include/asm/sync_core.h
|
|
@@ -93,7 +93,7 @@ static __always_inline void sync_core(void)
|
|
* to user-mode. x86 implements return to user-space through sysexit,
|
|
* sysrel, and sysretq, which are not core serializing.
|
|
*/
|
|
-static inline void sync_core_before_usermode(void)
|
|
+static __always_inline void sync_core_before_usermode(void)
|
|
{
|
|
/* With PTI, we unconditionally serialize before running user code. */
|
|
if (static_cpu_has(X86_FEATURE_PTI))
|
|
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
|
|
--- a/include/linux/perf_event.h
|
|
+++ b/include/linux/perf_event.h
|
|
@@ -1632,7 +1632,7 @@ static inline void perf_event_task_migrate(struct task_struct *task)
|
|
task->sched_migrated = 1;
|
|
}
|
|
|
|
-static inline void perf_event_task_sched_in(struct task_struct *prev,
|
|
+static __always_inline void perf_event_task_sched_in(struct task_struct *prev,
|
|
struct task_struct *task)
|
|
{
|
|
if (static_branch_unlikely(&perf_sched_events))
|
|
diff --git a/include/linux/sched/mm.h b/include/linux/sched/mm.h
|
|
--- a/include/linux/sched/mm.h
|
|
+++ b/include/linux/sched/mm.h
|
|
@@ -32,7 +32,7 @@ extern struct mm_struct *mm_alloc(void);
|
|
* See also <Documentation/mm/active_mm.rst> for an in-depth explanation
|
|
* of &mm_struct.mm_count vs &mm_struct.mm_users.
|
|
*/
|
|
-static inline void mmgrab(struct mm_struct *mm)
|
|
+static __always_inline void mmgrab(struct mm_struct *mm)
|
|
{
|
|
atomic_inc(&mm->mm_count);
|
|
}
|
|
@@ -44,7 +44,7 @@ static inline void smp_mb__after_mmgrab(void)
|
|
|
|
extern void __mmdrop(struct mm_struct *mm);
|
|
|
|
-static inline void mmdrop(struct mm_struct *mm)
|
|
+static __always_inline void mmdrop(struct mm_struct *mm)
|
|
{
|
|
/*
|
|
* The implicit full barrier implied by atomic_dec_and_test() is
|
|
@@ -71,27 +71,27 @@ static inline void __mmdrop_delayed(struct rcu_head *rhp)
|
|
* Invoked from finish_task_switch(). Delegates the heavy lifting on RT
|
|
* kernels via RCU.
|
|
*/
|
|
-static inline void mmdrop_sched(struct mm_struct *mm)
|
|
+static __always_inline void mmdrop_sched(struct mm_struct *mm)
|
|
{
|
|
/* Provides a full memory barrier. See mmdrop() */
|
|
if (atomic_dec_and_test(&mm->mm_count))
|
|
call_rcu(&mm->delayed_drop, __mmdrop_delayed);
|
|
}
|
|
#else
|
|
-static inline void mmdrop_sched(struct mm_struct *mm)
|
|
+static __always_inline void mmdrop_sched(struct mm_struct *mm)
|
|
{
|
|
mmdrop(mm);
|
|
}
|
|
#endif
|
|
|
|
/* Helpers for lazy TLB mm refcounting */
|
|
-static inline void mmgrab_lazy_tlb(struct mm_struct *mm)
|
|
+static __always_inline void mmgrab_lazy_tlb(struct mm_struct *mm)
|
|
{
|
|
if (IS_ENABLED(CONFIG_MMU_LAZY_TLB_REFCOUNT))
|
|
mmgrab(mm);
|
|
}
|
|
|
|
-static inline void mmdrop_lazy_tlb(struct mm_struct *mm)
|
|
+static __always_inline void mmdrop_lazy_tlb(struct mm_struct *mm)
|
|
{
|
|
if (IS_ENABLED(CONFIG_MMU_LAZY_TLB_REFCOUNT)) {
|
|
mmdrop(mm);
|
|
@@ -104,7 +104,7 @@ static inline void mmdrop_lazy_tlb(struct mm_struct *mm)
|
|
}
|
|
}
|
|
|
|
-static inline void mmdrop_lazy_tlb_sched(struct mm_struct *mm)
|
|
+static __always_inline void mmdrop_lazy_tlb_sched(struct mm_struct *mm)
|
|
{
|
|
if (IS_ENABLED(CONFIG_MMU_LAZY_TLB_REFCOUNT))
|
|
mmdrop_sched(mm);
|
|
@@ -128,12 +128,12 @@ static inline void mmdrop_lazy_tlb_sched(struct mm_struct *mm)
|
|
* See also <Documentation/mm/active_mm.rst> for an in-depth explanation
|
|
* of &mm_struct.mm_count vs &mm_struct.mm_users.
|
|
*/
|
|
-static inline void mmget(struct mm_struct *mm)
|
|
+static __always_inline void mmget(struct mm_struct *mm)
|
|
{
|
|
atomic_inc(&mm->mm_users);
|
|
}
|
|
|
|
-static inline bool mmget_not_zero(struct mm_struct *mm)
|
|
+static __always_inline bool mmget_not_zero(struct mm_struct *mm)
|
|
{
|
|
return atomic_inc_not_zero(&mm->mm_users);
|
|
}
|
|
@@ -532,7 +532,7 @@ enum {
|
|
#include <asm/membarrier.h>
|
|
#endif
|
|
|
|
-static inline void membarrier_mm_sync_core_before_usermode(struct mm_struct *mm)
|
|
+static __always_inline void membarrier_mm_sync_core_before_usermode(struct mm_struct *mm)
|
|
{
|
|
/*
|
|
* The atomic_read() below prevents CSE. The following should
|
|
diff --git a/include/linux/tick.h b/include/linux/tick.h
|
|
--- a/include/linux/tick.h
|
|
+++ b/include/linux/tick.h
|
|
@@ -175,7 +175,7 @@ extern cpumask_var_t tick_nohz_full_mask;
|
|
#ifdef CONFIG_NO_HZ_FULL
|
|
extern bool tick_nohz_full_running;
|
|
|
|
-static inline bool tick_nohz_full_enabled(void)
|
|
+static __always_inline bool tick_nohz_full_enabled(void)
|
|
{
|
|
if (!context_tracking_enabled())
|
|
return false;
|
|
@@ -299,7 +299,7 @@ static inline void __tick_nohz_task_switch(void) { }
|
|
static inline void tick_nohz_full_setup(cpumask_var_t cpumask) { }
|
|
#endif
|
|
|
|
-static inline void tick_nohz_task_switch(void)
|
|
+static __always_inline void tick_nohz_task_switch(void)
|
|
{
|
|
if (tick_nohz_full_enabled())
|
|
__tick_nohz_task_switch();
|
|
diff --git a/include/linux/vtime.h b/include/linux/vtime.h
|
|
--- a/include/linux/vtime.h
|
|
+++ b/include/linux/vtime.h
|
|
@@ -89,24 +89,24 @@ static __always_inline void vtime_account_guest_exit(void)
|
|
* For now vtime state is tied to context tracking. We might want to decouple
|
|
* those later if necessary.
|
|
*/
|
|
-static inline bool vtime_accounting_enabled(void)
|
|
+static __always_inline bool vtime_accounting_enabled(void)
|
|
{
|
|
return context_tracking_enabled();
|
|
}
|
|
|
|
-static inline bool vtime_accounting_enabled_cpu(int cpu)
|
|
+static __always_inline bool vtime_accounting_enabled_cpu(int cpu)
|
|
{
|
|
return vtime_generic_enabled_cpu(cpu);
|
|
}
|
|
|
|
-static inline bool vtime_accounting_enabled_this_cpu(void)
|
|
+static __always_inline bool vtime_accounting_enabled_this_cpu(void)
|
|
{
|
|
return vtime_generic_enabled_this_cpu();
|
|
}
|
|
|
|
extern void vtime_task_switch_generic(struct task_struct *prev);
|
|
|
|
-static inline void vtime_task_switch(struct task_struct *prev)
|
|
+static __always_inline void vtime_task_switch(struct task_struct *prev)
|
|
{
|
|
if (vtime_accounting_enabled_this_cpu())
|
|
vtime_task_switch_generic(prev);
|
|
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
|
|
--- a/kernel/sched/core.c
|
|
+++ b/kernel/sched/core.c
|
|
@@ -5098,7 +5098,7 @@ static inline void prepare_task(struct task_struct *next)
|
|
WRITE_ONCE(next->on_cpu, 1);
|
|
}
|
|
|
|
-static inline void finish_task(struct task_struct *prev)
|
|
+static __always_inline void finish_task(struct task_struct *prev)
|
|
{
|
|
/*
|
|
* This must be the very last reference to @prev from this CPU. After
|
|
@@ -5142,7 +5142,7 @@ static void zap_balance_callbacks(struct rq *rq)
|
|
rq->balance_callback = found ? &balance_push_callback : NULL;
|
|
}
|
|
|
|
-static void do_balance_callbacks(struct rq *rq, struct balance_callback *head)
|
|
+static __always_inline void do_balance_callbacks(struct rq *rq, struct balance_callback *head)
|
|
{
|
|
void (*func)(struct rq *rq);
|
|
struct balance_callback *next;
|
|
@@ -5177,7 +5177,7 @@ struct balance_callback balance_push_callback = {
|
|
.func = balance_push,
|
|
};
|
|
|
|
-static inline struct balance_callback *
|
|
+static __always_inline struct balance_callback *
|
|
__splice_balance_callbacks(struct rq *rq, bool split)
|
|
{
|
|
struct balance_callback *head = rq->balance_callback;
|
|
@@ -5251,7 +5251,7 @@ prepare_lock_switch(struct rq *rq, struct task_struct *next, struct rq_flags *rf
|
|
__acquire(__rq_lockp(this_rq()));
|
|
}
|
|
|
|
-static inline void finish_lock_switch(struct rq *rq)
|
|
+static __always_inline void finish_lock_switch(struct rq *rq)
|
|
__releases(__rq_lockp(rq))
|
|
{
|
|
/*
|
|
@@ -5285,7 +5285,7 @@ static inline void kmap_local_sched_out(void)
|
|
#endif
|
|
}
|
|
|
|
-static inline void kmap_local_sched_in(void)
|
|
+static __always_inline void kmap_local_sched_in(void)
|
|
{
|
|
#ifdef CONFIG_KMAP_LOCAL
|
|
if (unlikely(current->kmap_ctrl.idx))
|
|
@@ -5339,7 +5339,7 @@ prepare_task_switch(struct rq *rq, struct task_struct *prev,
|
|
* past. 'prev == current' is still correct but we need to recalculate this_rq
|
|
* because prev may have moved to another CPU.
|
|
*/
|
|
-static struct rq *finish_task_switch(struct task_struct *prev)
|
|
+static __always_inline struct rq *finish_task_switch(struct task_struct *prev)
|
|
__releases(__rq_lockp(this_rq()))
|
|
{
|
|
struct rq *rq = this_rq();
|
|
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
|
|
--- a/kernel/sched/sched.h
|
|
+++ b/kernel/sched/sched.h
|
|
@@ -1460,12 +1460,12 @@ static inline struct cpumask *sched_group_span(struct sched_group *sg);
|
|
|
|
DECLARE_STATIC_KEY_FALSE(__sched_core_enabled);
|
|
|
|
-static inline bool sched_core_enabled(struct rq *rq)
|
|
+static __always_inline bool sched_core_enabled(struct rq *rq)
|
|
{
|
|
return static_branch_unlikely(&__sched_core_enabled) && rq->core_enabled;
|
|
}
|
|
|
|
-static inline bool sched_core_disabled(void)
|
|
+static __always_inline bool sched_core_disabled(void)
|
|
{
|
|
return !static_branch_unlikely(&__sched_core_enabled);
|
|
}
|
|
@@ -1474,7 +1474,7 @@ static inline bool sched_core_disabled(void)
|
|
* Be careful with this function; not for general use. The return value isn't
|
|
* stable unless you actually hold a relevant rq->__lock.
|
|
*/
|
|
-static inline raw_spinlock_t *rq_lockp(struct rq *rq)
|
|
+static __always_inline raw_spinlock_t *rq_lockp(struct rq *rq)
|
|
{
|
|
if (sched_core_enabled(rq))
|
|
return &rq->core->__lock;
|
|
@@ -1482,7 +1482,7 @@ static inline raw_spinlock_t *rq_lockp(struct rq *rq)
|
|
return &rq->__lock;
|
|
}
|
|
|
|
-static inline raw_spinlock_t *__rq_lockp(struct rq *rq)
|
|
+static __always_inline raw_spinlock_t *__rq_lockp(struct rq *rq)
|
|
__returns_ctx_lock(rq_lockp(rq)) /* alias them */
|
|
{
|
|
if (rq->core_enabled)
|
|
@@ -1585,12 +1585,12 @@ static inline bool sched_core_disabled(void)
|
|
return true;
|
|
}
|
|
|
|
-static inline raw_spinlock_t *rq_lockp(struct rq *rq)
|
|
+static __always_inline raw_spinlock_t *rq_lockp(struct rq *rq)
|
|
{
|
|
return &rq->__lock;
|
|
}
|
|
|
|
-static inline raw_spinlock_t *__rq_lockp(struct rq *rq)
|
|
+static __always_inline raw_spinlock_t *__rq_lockp(struct rq *rq)
|
|
__returns_ctx_lock(rq_lockp(rq)) /* alias them */
|
|
{
|
|
return &rq->__lock;
|
|
@@ -1650,33 +1650,33 @@ extern void raw_spin_rq_lock_nested(struct rq *rq, int subclass)
|
|
extern bool raw_spin_rq_trylock(struct rq *rq)
|
|
__cond_acquires(true, __rq_lockp(rq));
|
|
|
|
-static inline void raw_spin_rq_lock(struct rq *rq)
|
|
+static __always_inline void raw_spin_rq_lock(struct rq *rq)
|
|
__acquires(__rq_lockp(rq))
|
|
{
|
|
raw_spin_rq_lock_nested(rq, 0);
|
|
}
|
|
|
|
-static inline void raw_spin_rq_unlock(struct rq *rq)
|
|
+static __always_inline void raw_spin_rq_unlock(struct rq *rq)
|
|
__releases(__rq_lockp(rq))
|
|
{
|
|
raw_spin_unlock(rq_lockp(rq));
|
|
}
|
|
|
|
-static inline void raw_spin_rq_lock_irq(struct rq *rq)
|
|
+static __always_inline void raw_spin_rq_lock_irq(struct rq *rq)
|
|
__acquires(__rq_lockp(rq))
|
|
{
|
|
local_irq_disable();
|
|
raw_spin_rq_lock(rq);
|
|
}
|
|
|
|
-static inline void raw_spin_rq_unlock_irq(struct rq *rq)
|
|
+static __always_inline void raw_spin_rq_unlock_irq(struct rq *rq)
|
|
__releases(__rq_lockp(rq))
|
|
{
|
|
raw_spin_rq_unlock(rq);
|
|
local_irq_enable();
|
|
}
|
|
|
|
-static inline unsigned long _raw_spin_rq_lock_irqsave(struct rq *rq)
|
|
+static __always_inline unsigned long _raw_spin_rq_lock_irqsave(struct rq *rq)
|
|
__acquires(__rq_lockp(rq))
|
|
{
|
|
unsigned long flags;
|
|
@@ -1687,7 +1687,7 @@ static inline unsigned long _raw_spin_rq_lock_irqsave(struct rq *rq)
|
|
return flags;
|
|
}
|
|
|
|
-static inline void raw_spin_rq_unlock_irqrestore(struct rq *rq, unsigned long flags)
|
|
+static __always_inline void raw_spin_rq_unlock_irqrestore(struct rq *rq, unsigned long flags)
|
|
__releases(__rq_lockp(rq))
|
|
{
|
|
raw_spin_rq_unlock(rq);
|