lkml.org 
[lkml]   [2020]   [Nov]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[RFC PATCH 6/7] preempt/dynamic: Provide irqentry_exit_cond_resched() static call
    Date
    From: "Peter Zijlstra (Intel)" <peterz@infradead.org>

    Provide static call to control IRQ preemption (called in CONFIG_PREEMPT)
    so that we can override its behaviour when preempt= is overriden.

    Since the default behaviour is full preemption, its call is
    initialized to provide IRQ preemption when preempt= isn't passed.

    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: Mel Gorman <mgorman@suse.de>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Michal Hocko <mhocko@kernel.org>
    Cc: Paul E. McKenney <paulmck@kernel.org>
    [convert from static key to static call, only define static call when
    PREEMPT_DYNAMIC]
    Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
    ---
    include/linux/entry-common.h | 4 ++++
    kernel/entry/common.c | 10 +++++++++-
    2 files changed, 13 insertions(+), 1 deletion(-)

    diff --git a/include/linux/entry-common.h b/include/linux/entry-common.h
    index 474f29638d2c..36738f67f6ad 100644
    --- a/include/linux/entry-common.h
    +++ b/include/linux/entry-common.h
    @@ -2,6 +2,7 @@
    #ifndef __LINUX_ENTRYCOMMON_H
    #define __LINUX_ENTRYCOMMON_H

    +#include <linux/static_call_types.h>
    #include <linux/tracehook.h>
    #include <linux/syscalls.h>
    #include <linux/seccomp.h>
    @@ -385,6 +386,9 @@ irqentry_state_t noinstr irqentry_enter(struct pt_regs *regs);
    * Conditional reschedule with additional sanity checks.
    */
    void irqentry_exit_cond_resched(void);
    +#ifdef CONFIG_PREEMPT_DYNAMIC
    +DECLARE_STATIC_CALL(irqentry_exit_cond_resched, irqentry_exit_cond_resched);
    +#endif

    /**
    * irqentry_exit - Handle return from exception that used irqentry_enter()
    diff --git a/kernel/entry/common.c b/kernel/entry/common.c
    index 2b8366693d5c..c501c951f8bc 100644
    --- a/kernel/entry/common.c
    +++ b/kernel/entry/common.c
    @@ -357,6 +357,9 @@ void irqentry_exit_cond_resched(void)
    preempt_schedule_irq();
    }
    }
    +#ifdef CONFIG_PREEMPT_DYNAMIC
    +DEFINE_STATIC_CALL(irqentry_exit_cond_resched, irqentry_exit_cond_resched);
    +#endif

    noinstr void irqentry_exit(struct pt_regs *regs, irqentry_state_t state)
    {
    @@ -383,8 +386,13 @@ noinstr void irqentry_exit(struct pt_regs *regs, irqentry_state_t state)
    }

    instrumentation_begin();
    - if (IS_ENABLED(CONFIG_PREEMPTION))
    + if (IS_ENABLED(CONFIG_PREEMPTION)) {
    +#ifdef CONFIG_PREEMT_DYNAMIC
    + static_call(irqentry_exit_cond_resched)();
    +#else
    irqentry_exit_cond_resched();
    +#endif
    + }
    /* Covers both tracing and lockdep */
    trace_hardirqs_on();
    instrumentation_end();
    --
    2.25.1
    \
     
     \ /
      Last update: 2020-11-10 01:57    [W:2.855 / U:0.028 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site