Skip to content

Commit 40607ee

Browse files
Peter Zijlstra (Intel)Ingo Molnar
authored andcommitted
preempt/dynamic: Provide irqentry_exit_cond_resched() static call
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> Signed-off-by: Frederic Weisbecker <frederic@kernel.org> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Ingo Molnar <mingo@kernel.org> Link: https://lkml.kernel.org/r/20210118141223.123667-8-frederic@kernel.org
1 parent 2c9a98d commit 40607ee

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

include/linux/entry-common.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#ifndef __LINUX_ENTRYCOMMON_H
33
#define __LINUX_ENTRYCOMMON_H
44

5+
#include <linux/static_call_types.h>
56
#include <linux/tracehook.h>
67
#include <linux/syscalls.h>
78
#include <linux/seccomp.h>
@@ -454,6 +455,9 @@ irqentry_state_t noinstr irqentry_enter(struct pt_regs *regs);
454455
* Conditional reschedule with additional sanity checks.
455456
*/
456457
void irqentry_exit_cond_resched(void);
458+
#ifdef CONFIG_PREEMPT_DYNAMIC
459+
DECLARE_STATIC_CALL(irqentry_exit_cond_resched, irqentry_exit_cond_resched);
460+
#endif
457461

458462
/**
459463
* irqentry_exit - Handle return from exception that used irqentry_enter()

kernel/entry/common.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,9 @@ void irqentry_exit_cond_resched(void)
385385
preempt_schedule_irq();
386386
}
387387
}
388+
#ifdef CONFIG_PREEMPT_DYNAMIC
389+
DEFINE_STATIC_CALL(irqentry_exit_cond_resched, irqentry_exit_cond_resched);
390+
#endif
388391

389392
noinstr void irqentry_exit(struct pt_regs *regs, irqentry_state_t state)
390393
{
@@ -411,8 +414,13 @@ noinstr void irqentry_exit(struct pt_regs *regs, irqentry_state_t state)
411414
}
412415

413416
instrumentation_begin();
414-
if (IS_ENABLED(CONFIG_PREEMPTION))
417+
if (IS_ENABLED(CONFIG_PREEMPTION)) {
418+
#ifdef CONFIG_PREEMT_DYNAMIC
419+
static_call(irqentry_exit_cond_resched)();
420+
#else
415421
irqentry_exit_cond_resched();
422+
#endif
423+
}
416424
/* Covers both tracing and lockdep */
417425
trace_hardirqs_on();
418426
instrumentation_end();

0 commit comments

Comments
 (0)