[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160727103814.GB8845@gmail.com>
Date: Wed, 27 Jul 2016 12:38:14 +0200
From: Ingo Molnar <mingo@...nel.org>
To: Vegard Nossum <vegard.nossum@...il.com>
Cc: Vegard Nossum <vegard.nossum@...cle.com>,
Ingo Molnar <mingo@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
LKML <linux-kernel@...r.kernel.org>,
"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
Thomas Gleixner <tglx@...utronix.de>,
Rusty Russel <rusty@...tcorp.com.au>
Subject: Re: [PATCH] sched/core: make "Preemption disabled at" message more
useful
* Vegard Nossum <vegard.nossum@...il.com> wrote:
> On 27 July 2016 at 11:15, Ingo Molnar <mingo@...nel.org> wrote:
> >
> > * Vegard Nossum <vegard.nossum@...cle.com> wrote:
> [...]
>
> > These two blocks could be merged trivially, avoiding an #ifdef pair ...
>
> >> @@ -7541,6 +7550,9 @@ EXPORT_SYMBOL(__might_sleep);
> >> void ___might_sleep(const char *file, int line, int preempt_offset)
> >> {
> >> static unsigned long prev_jiffy; /* ratelimiting */
> >> +#ifdef CONFIG_DEBUG_PREEMPT
> >> + unsigned long preempt_disable_ip;
> >> +#endif
> >>
> >> rcu_sleep_check(); /* WARN_ON_ONCE() by default, no rate limit reqd. */
> >> if ((preempt_count_equals(preempt_offset) && !irqs_disabled() &&
> >> @@ -7551,6 +7563,11 @@ void ___might_sleep(const char *file, int line, int preempt_offset)
> >> return;
> >> prev_jiffy = jiffies;
> >>
> >> +#ifdef CONFIG_DEBUG_PREEMPT
> >> + /* Save this before calling printk(), since that will clobber it */
> >> + preempt_disable_ip = current->preempt_disable_ip;
> >> +#endif
> >
> > Ditto.
>
> I'm assuming you want to declare and initialise preempt_disable_ip at
> once here, but it generates slightly worse code since it dereferences
> current->preempt_disable_ip in the "fast path" (i.e. a sleeping
> function is NOT called from an invalid context).
Could you please add a likely() branch to see whether GCC will delay the
initialization?
The 4 #ifdefs were really ugly, so yes, it would be nice to at least reduce them
to 2.
Thanks,
Ingo
Powered by blists - more mailing lists