[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2802327e499a43cf832d84237436959c@AcuMS.aculab.com>
Date: Fri, 20 Jul 2018 14:04:19 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Tetsuo Handa' <penguin-kernel@...ove.sakura.ne.jp>,
Peter Zijlstra <peterz@...radead.org>
CC: "James E.J. Bottomley" <jejb@...ux.vnet.ibm.com>,
"Martin K. Petersen" <martin.petersen@...cle.com>,
Ingo Molnar <mingo@...hat.com>,
Thomas Gleixner <tglx@...utronix.de>,
Tejun Heo <tj@...nel.org>,
"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Dmitry Vyukov <dvyukov@...gle.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [RFC PATCH] sched/debug: Use terse backtrace for idly sleeping
threads.
From: Tetsuo Handa
> Sent: 20 July 2018 14:27
>
> On 2018/07/19 22:46, Peter Zijlstra wrote:
> > On Thu, Jul 19, 2018 at 10:37:23PM +0900, Tetsuo Handa wrote:
> >> This patch can be applied before proposing abovementioned changes.
> >> Since there are many kernel threads whose backtrace is boring due to idly
> >> waiting for an event inside the main loop, this patch introduces a kernel
> >> config option (which allows SysRq-t to use one-liner backtrace for threads
> >> idly waiting for an event) and simple helpers (which allow current thread
> >> to declare that current thread is about to start/end idly waiting).
A kernel config option isn't the right place to select this.
Distros will build kernels with the 'wrong' value.
In any case it is usually easier to read /proc/nnn/stack of the process
you are interested it rather than write all of them to the kernel message
buffer and find that it is far too small.
> >> diff --git a/drivers/base/devtmpfs.c b/drivers/base/devtmpfs.c
> >> index f776807..6b8c8bd 100644
> >> --- a/drivers/base/devtmpfs.c
> >> +++ b/drivers/base/devtmpfs.c
> >> @@ -406,7 +406,9 @@ static int devtmpfsd(void *p)
> >> }
> >> __set_current_state(TASK_INTERRUPTIBLE);
> >> spin_unlock(&req_lock);
> >> + start_idle_sleeping();
> >> schedule();
> >> + end_idle_sleeping();
> >> }
> >> return 0;
> >> out:
> >
> > So I _really_ hate the idea of sprinking that all around the kernel like
> > this.
> >
>
> Does that comment mean the idea of "using one-liner backtrace for threads
> idly waiting for an event" itself is OK?
Aren't such stack traces likely to be short ones anyway?
Either that or you actually want to know where it is really waiting.
> Since there already is schedule_idle() function, introducing idly_schedule()
> etc. is very confusing. What I'm trying to do is to tell debug function that
> "I'm currently in neutral situation and hence dumping my backtrace will not
> give you interesting result". Since such section needs to be carefully
> annotated with comments, I think that lockdep-like annotation fits better
> than introducing wrapped functions.
Or use extra bits of current->state set by set_current_state().
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
Powered by blists - more mailing lists