[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LNX.2.00.1502200830430.28769@pobox.suse.cz>
Date: Fri, 20 Feb 2015 08:46:52 +0100 (CET)
From: Jiri Kosina <jkosina@...e.cz>
To: Josh Poimboeuf <jpoimboe@...hat.com>
cc: Vojtech Pavlik <vojtech@...e.com>,
Peter Zijlstra <peterz@...radead.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Ingo Molnar <mingo@...hat.com>,
Seth Jennings <sjenning@...hat.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/3] sched: add sched_task_call()
On Thu, 19 Feb 2015, Josh Poimboeuf wrote:
> So I've looked at kgr_needs_lazy_migration(), but I still have no idea
> how it works.
>
> First of all, I think reading the stack while its being written to could
> give you some garbage values, and a completely wrong nr_entries value
> from save_stack_trace_tsk().
I believe we've already been discussing this some time ago ...
I agree that this is a very crude optimization that should probably be
either removed (which would only cause slower convergence in the presence
of CPU-bound tasks), or rewritten to perform IPI-based stack dumping
(probably on a voluntarily-configurable basis).
Reading garbage values could only happen if the task would be running in
kernelspace. nr_entries would then be at least 2.
But I agree that relying on this very specific behavior is not really
safe in general in case someone changes the stack dumping implementation
in the future in an unpredictable way.
> But also, how would you walk a stack without knowing its stack pointer?
> That function relies on the saved stack pointer in
> task_struct.thread.sp, which, AFAICT, was last saved during the last
> call to schedule(). Since then, the stack could have been completely
> rewritten, with different size stack frames, before the task exited the
> kernel.
Same argument holds here as well, I believe.
Thanks,
--
Jiri Kosina
SUSE Labs
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists