All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@kernel.org>
To: Vegard Nossum <vegard.nossum@gmail.com>
Cc: Vegard Nossum <vegard.nossum@oracle.com>,
	Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	LKML <linux-kernel@vger.kernel.org>,
	"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Rusty Russel <rusty@rustcorp.com.au>
Subject: Re: [PATCH] sched/core: make "Preemption disabled at" message more useful
Date: Wed, 27 Jul 2016 12:38:14 +0200	[thread overview]
Message-ID: <20160727103814.GB8845@gmail.com> (raw)
In-Reply-To: <CAOMGZ=EBmgqgwrOmzqJaiGBmyoN7zG5AOEmeQ7LRymY65pHFqw@mail.gmail.com>


* Vegard Nossum <vegard.nossum@gmail.com> wrote:

> On 27 July 2016 at 11:15, Ingo Molnar <mingo@kernel.org> wrote:
> >
> > * Vegard Nossum <vegard.nossum@oracle.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

  reply	other threads:[~2016-07-27 10:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-23  7:58 [PATCH] sched/core: make "Preemption disabled at" message more useful Vegard Nossum
2016-07-27  9:15 ` Ingo Molnar
2016-07-27  9:36   ` Vegard Nossum
2016-07-27 10:38     ` Ingo Molnar [this message]
2016-07-27 12:25       ` Vegard Nossum

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160727103814.GB8845@gmail.com \
    --to=mingo@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=peterz@infradead.org \
    --cc=rusty@rustcorp.com.au \
    --cc=tglx@linutronix.de \
    --cc=vegard.nossum@gmail.com \
    --cc=vegard.nossum@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.