Re: [tip:sched/core] sched/preempt: Optimize preemption operations on __schedule() callers

Peter Zijlstra
2015-07-21T11:07:13Z

On Mon, Jul 20, 2015 at 06:14:27PM -0400, Sasha Levin wrote:
> On 05/19/2015 03:17 AM, tip-bot for Frederic Weisbecker wrote:
> > Commit-ID: b30f0e3ffedfa52b1d67a302ae5860c49998e5e2

> > sched/preempt: Optimize preemption operations on __schedule() callers
> >

> I was seeing RCU stall warnings that appeared to have different backtrace
> each time, but would reliably trigger when fuzzing and looked something like this:

> [4394886.426627] preempt_schedule_irq (./arch/x86/include/asm/paravirt.h:807 kernel/sched/core.c:3218)

The only 'obvious' difference there seems to be something like the
below. Prior to the patch preempt_schedule_irq() used
__preempt_count_{add,sub}() which are the !tracing versions.

Does this make it go again? If not, can you provide a .config?

---
include/linux/preempt.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/preempt.h b/include/linux/preempt.h
index 84991f185173..235a9f2d76fe 100644
--- a/include/linux/preempt.h
+++ b/include/linux/preempt.h
@@ -139,14 +139,14 @@ extern void preempt_count_sub(int val);

#define preempt_active_enter() \
do { \
- preempt_count_add(PREEMPT_ACTIVE + PREEMPT_DISABLE_OFFSET); \
+ __preempt_count_add(PREEMPT_ACTIVE + PREEMPT_DISABLE_OFFSET); \
barrier(); \
} while (0)

#define preempt_active_exit() \
do { \
barrier(); \
- preempt_count_sub(PREEMPT_ACTIVE + PREEMPT_DISABLE_OFFSET); \
+ __preempt_count_sub(PREEMPT_ACTIVE + PREEMPT_DISABLE_OFFSET); \
} while (0)

#ifdef CONFIG_PREEMPT_COUNT