From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754887AbcG0KiT (ORCPT ); Wed, 27 Jul 2016 06:38:19 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:33416 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752142AbcG0KiS (ORCPT ); Wed, 27 Jul 2016 06:38:18 -0400 Date: Wed, 27 Jul 2016 12:38:14 +0200 From: Ingo Molnar To: Vegard Nossum Cc: Vegard Nossum , Ingo Molnar , Peter Zijlstra , LKML , "Paul E. McKenney" , Thomas Gleixner , Rusty Russel Subject: Re: [PATCH] sched/core: make "Preemption disabled at" message more useful Message-ID: <20160727103814.GB8845@gmail.com> References: <1469260693-22260-1-git-send-email-vegard.nossum@oracle.com> <20160727091527.GB6323@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Vegard Nossum wrote: > On 27 July 2016 at 11:15, Ingo Molnar wrote: > > > > * Vegard Nossum 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