Re: sched: horrible way to detect whether a task has been preempted

2016-04-11 Thread Petr Mladek
On Fri 2016-04-08 09:31:31, Josh Poimboeuf wrote: > On Fri, Apr 08, 2016 at 10:03:04AM +0200, Petr Mladek wrote: > > The big advantage about checking the stack is that it does not add > > any overhead to the scheduler code, does not eat any TIF flag or > > memory. The overhead is only when we are

Re: sched: horrible way to detect whether a task has been preempted

2016-04-11 Thread Petr Mladek
On Fri 2016-04-08 09:31:31, Josh Poimboeuf wrote: > On Fri, Apr 08, 2016 at 10:03:04AM +0200, Petr Mladek wrote: > > The big advantage about checking the stack is that it does not add > > any overhead to the scheduler code, does not eat any TIF flag or > > memory. The overhead is only when we are

Re: [RFC PATCH v1.9 05/14] sched: horrible way to detect whether a task has been preempted

2016-04-08 Thread Josh Poimboeuf
On Fri, Apr 08, 2016 at 10:07:10AM +0200, Petr Mladek wrote: > On Thu 2016-04-07 09:34:03, Josh Poimboeuf wrote: > > On Thu, Apr 07, 2016 at 11:47:00AM +0200, Petr Mladek wrote: > > > On Wed 2016-04-06 11:33:56, Josh Poimboeuf wrote: > > > > On Wed, Apr 06, 2016 at 03:06:19PM +0200, Petr Mladek

Re: [RFC PATCH v1.9 05/14] sched: horrible way to detect whether a task has been preempted

2016-04-08 Thread Josh Poimboeuf
On Fri, Apr 08, 2016 at 10:07:10AM +0200, Petr Mladek wrote: > On Thu 2016-04-07 09:34:03, Josh Poimboeuf wrote: > > On Thu, Apr 07, 2016 at 11:47:00AM +0200, Petr Mladek wrote: > > > On Wed 2016-04-06 11:33:56, Josh Poimboeuf wrote: > > > > On Wed, Apr 06, 2016 at 03:06:19PM +0200, Petr Mladek

Re: sched: horrible way to detect whether a task has been preempted

2016-04-08 Thread Josh Poimboeuf
On Fri, Apr 08, 2016 at 10:03:04AM +0200, Petr Mladek wrote: > On Fri 2016-04-08 09:05:28, Jiri Kosina wrote: > > On Thu, 7 Apr 2016, Jessica Yu wrote: > > > > > > Alternatively, without eating up a TIF_ space, it'd be possible to push > > > > a > > > > magic contents on top of the stack in

Re: sched: horrible way to detect whether a task has been preempted

2016-04-08 Thread Josh Poimboeuf
On Fri, Apr 08, 2016 at 10:03:04AM +0200, Petr Mladek wrote: > On Fri 2016-04-08 09:05:28, Jiri Kosina wrote: > > On Thu, 7 Apr 2016, Jessica Yu wrote: > > > > > > Alternatively, without eating up a TIF_ space, it'd be possible to push > > > > a > > > > magic contents on top of the stack in

Re: [RFC PATCH v1.9 05/14] sched: horrible way to detect whether a task has been preempted

2016-04-08 Thread Petr Mladek
On Thu 2016-04-07 09:34:03, Josh Poimboeuf wrote: > On Thu, Apr 07, 2016 at 11:47:00AM +0200, Petr Mladek wrote: > > On Wed 2016-04-06 11:33:56, Josh Poimboeuf wrote: > > > On Wed, Apr 06, 2016 at 03:06:19PM +0200, Petr Mladek wrote: > > We could even move this check into the livepatch code but

Re: [RFC PATCH v1.9 05/14] sched: horrible way to detect whether a task has been preempted

2016-04-08 Thread Petr Mladek
On Thu 2016-04-07 09:34:03, Josh Poimboeuf wrote: > On Thu, Apr 07, 2016 at 11:47:00AM +0200, Petr Mladek wrote: > > On Wed 2016-04-06 11:33:56, Josh Poimboeuf wrote: > > > On Wed, Apr 06, 2016 at 03:06:19PM +0200, Petr Mladek wrote: > > We could even move this check into the livepatch code but

Re: sched: horrible way to detect whether a task has been preempted

2016-04-08 Thread Petr Mladek
On Fri 2016-04-08 09:05:28, Jiri Kosina wrote: > On Thu, 7 Apr 2016, Jessica Yu wrote: > > > > Alternatively, without eating up a TIF_ space, it'd be possible to push a > > > magic contents on top of the stack in preempt_schedule_irq() (and pop it > > > once we are returning from there), and if

Re: sched: horrible way to detect whether a task has been preempted

2016-04-08 Thread Petr Mladek
On Fri 2016-04-08 09:05:28, Jiri Kosina wrote: > On Thu, 7 Apr 2016, Jessica Yu wrote: > > > > Alternatively, without eating up a TIF_ space, it'd be possible to push a > > > magic contents on top of the stack in preempt_schedule_irq() (and pop it > > > once we are returning from there), and if

Re: sched: horrible way to detect whether a task has been preempted

2016-04-08 Thread Jiri Kosina
On Thu, 7 Apr 2016, Jessica Yu wrote: > > Alternatively, without eating up a TIF_ space, it'd be possible to push a > > magic contents on top of the stack in preempt_schedule_irq() (and pop it > > once we are returning from there), and if such magic value is detected, we > > just don't bother and

Re: sched: horrible way to detect whether a task has been preempted

2016-04-08 Thread Jiri Kosina
On Thu, 7 Apr 2016, Jessica Yu wrote: > > Alternatively, without eating up a TIF_ space, it'd be possible to push a > > magic contents on top of the stack in preempt_schedule_irq() (and pop it > > once we are returning from there), and if such magic value is detected, we > > just don't bother and

Re: sched: horrible way to detect whether a task has been preempted

2016-04-07 Thread Jessica Yu
+++ Jiri Kosina [07/04/16 23:37 +0200]: On Thu, 7 Apr 2016, Jessica Yu wrote: Been sort of rattling my head over the scheduler code :-) Just following the calls in and out of __schedule() it doesn't look like there is a current flag/mechanism to tell whether or not a task has been preempted..

Re: sched: horrible way to detect whether a task has been preempted

2016-04-07 Thread Jessica Yu
+++ Jiri Kosina [07/04/16 23:37 +0200]: On Thu, 7 Apr 2016, Jessica Yu wrote: Been sort of rattling my head over the scheduler code :-) Just following the calls in and out of __schedule() it doesn't look like there is a current flag/mechanism to tell whether or not a task has been preempted..

Re: sched: horrible way to detect whether a task has been preempted

2016-04-07 Thread Jiri Kosina
On Thu, 7 Apr 2016, Josh Poimboeuf wrote: > To do that from C code, I guess we'd still need some arch-specific code > in an asm() statement to do the actual push? This could potentially be worked around I believe (thinking for example of a onstack-allocated local variable with predefined

Re: sched: horrible way to detect whether a task has been preempted

2016-04-07 Thread Jiri Kosina
On Thu, 7 Apr 2016, Josh Poimboeuf wrote: > To do that from C code, I guess we'd still need some arch-specific code > in an asm() statement to do the actual push? This could potentially be worked around I believe (thinking for example of a onstack-allocated local variable with predefined

Re: sched: horrible way to detect whether a task has been preempted

2016-04-07 Thread Josh Poimboeuf
On Thu, Apr 07, 2016 at 11:37:19PM +0200, Jiri Kosina wrote: > On Thu, 7 Apr 2016, Jessica Yu wrote: > > > Been sort of rattling my head over the scheduler code :-) Just following > > the calls in and out of __schedule() it doesn't look like there is a > > current flag/mechanism to tell whether

Re: sched: horrible way to detect whether a task has been preempted

2016-04-07 Thread Josh Poimboeuf
On Thu, Apr 07, 2016 at 11:37:19PM +0200, Jiri Kosina wrote: > On Thu, 7 Apr 2016, Jessica Yu wrote: > > > Been sort of rattling my head over the scheduler code :-) Just following > > the calls in and out of __schedule() it doesn't look like there is a > > current flag/mechanism to tell whether

Re: sched: horrible way to detect whether a task has been preempted

2016-04-07 Thread Jiri Kosina
On Thu, 7 Apr 2016, Jessica Yu wrote: > Been sort of rattling my head over the scheduler code :-) Just following > the calls in and out of __schedule() it doesn't look like there is a > current flag/mechanism to tell whether or not a task has been > preempted.. Performing the complete stack

Re: sched: horrible way to detect whether a task has been preempted

2016-04-07 Thread Jiri Kosina
On Thu, 7 Apr 2016, Jessica Yu wrote: > Been sort of rattling my head over the scheduler code :-) Just following > the calls in and out of __schedule() it doesn't look like there is a > current flag/mechanism to tell whether or not a task has been > preempted.. Performing the complete stack

Re: sched: horrible way to detect whether a task has been preempted

2016-04-07 Thread Jessica Yu
+++ Josh Poimboeuf [25/03/16 14:34 -0500]: This is a horrible way to detect whether a task has been preempted. Come up with something better: task flag? or is there already an existing mechanism? Signed-off-by: Josh Poimboeuf --- include/linux/sched.h | 11 ++-

Re: sched: horrible way to detect whether a task has been preempted

2016-04-07 Thread Jessica Yu
+++ Josh Poimboeuf [25/03/16 14:34 -0500]: This is a horrible way to detect whether a task has been preempted. Come up with something better: task flag? or is there already an existing mechanism? Signed-off-by: Josh Poimboeuf --- include/linux/sched.h | 11 ++- kernel/sched/core.c |

Re: [RFC PATCH v1.9 05/14] sched: horrible way to detect whether a task has been preempted

2016-04-07 Thread Josh Poimboeuf
On Thu, Apr 07, 2016 at 11:47:00AM +0200, Petr Mladek wrote: > On Wed 2016-04-06 11:33:56, Josh Poimboeuf wrote: > > On Wed, Apr 06, 2016 at 03:06:19PM +0200, Petr Mladek wrote: > > > On Fri 2016-03-25 14:34:52, Josh Poimboeuf wrote: > > > > This is a horrible way to detect whether a task has been

Re: [RFC PATCH v1.9 05/14] sched: horrible way to detect whether a task has been preempted

2016-04-07 Thread Josh Poimboeuf
On Thu, Apr 07, 2016 at 11:47:00AM +0200, Petr Mladek wrote: > On Wed 2016-04-06 11:33:56, Josh Poimboeuf wrote: > > On Wed, Apr 06, 2016 at 03:06:19PM +0200, Petr Mladek wrote: > > > On Fri 2016-03-25 14:34:52, Josh Poimboeuf wrote: > > > > This is a horrible way to detect whether a task has been

Re: [RFC PATCH v1.9 05/14] sched: horrible way to detect whether a task has been preempted

2016-04-07 Thread Petr Mladek
On Wed 2016-04-06 11:33:56, Josh Poimboeuf wrote: > On Wed, Apr 06, 2016 at 03:06:19PM +0200, Petr Mladek wrote: > > On Fri 2016-03-25 14:34:52, Josh Poimboeuf wrote: > > > This is a horrible way to detect whether a task has been preempted. > > > Come up with something better: task flag? or is

Re: [RFC PATCH v1.9 05/14] sched: horrible way to detect whether a task has been preempted

2016-04-07 Thread Petr Mladek
On Wed 2016-04-06 11:33:56, Josh Poimboeuf wrote: > On Wed, Apr 06, 2016 at 03:06:19PM +0200, Petr Mladek wrote: > > On Fri 2016-03-25 14:34:52, Josh Poimboeuf wrote: > > > This is a horrible way to detect whether a task has been preempted. > > > Come up with something better: task flag? or is

Re: [RFC PATCH v1.9 05/14] sched: horrible way to detect whether a task has been preempted

2016-04-06 Thread Josh Poimboeuf
On Wed, Apr 06, 2016 at 03:06:19PM +0200, Petr Mladek wrote: > On Fri 2016-03-25 14:34:52, Josh Poimboeuf wrote: > > This is a horrible way to detect whether a task has been preempted. > > Come up with something better: task flag? or is there already an > > existing mechanism? > > What about

Re: [RFC PATCH v1.9 05/14] sched: horrible way to detect whether a task has been preempted

2016-04-06 Thread Josh Poimboeuf
On Wed, Apr 06, 2016 at 03:06:19PM +0200, Petr Mladek wrote: > On Fri 2016-03-25 14:34:52, Josh Poimboeuf wrote: > > This is a horrible way to detect whether a task has been preempted. > > Come up with something better: task flag? or is there already an > > existing mechanism? > > What about

Re: [RFC PATCH v1.9 05/14] sched: horrible way to detect whether a task has been preempted

2016-04-06 Thread Petr Mladek
On Fri 2016-03-25 14:34:52, Josh Poimboeuf wrote: > This is a horrible way to detect whether a task has been preempted. > Come up with something better: task flag? or is there already an > existing mechanism? What about using kallsyms_lookup_size_offset() to check the address. It is more

Re: [RFC PATCH v1.9 05/14] sched: horrible way to detect whether a task has been preempted

2016-04-06 Thread Petr Mladek
On Fri 2016-03-25 14:34:52, Josh Poimboeuf wrote: > This is a horrible way to detect whether a task has been preempted. > Come up with something better: task flag? or is there already an > existing mechanism? What about using kallsyms_lookup_size_offset() to check the address. It is more

[RFC PATCH v1.9 05/14] sched: horrible way to detect whether a task has been preempted

2016-03-25 Thread Josh Poimboeuf
This is a horrible way to detect whether a task has been preempted. Come up with something better: task flag? or is there already an existing mechanism? Signed-off-by: Josh Poimboeuf --- include/linux/sched.h | 11 ++- kernel/sched/core.c | 26

[RFC PATCH v1.9 05/14] sched: horrible way to detect whether a task has been preempted

2016-03-25 Thread Josh Poimboeuf
This is a horrible way to detect whether a task has been preempted. Come up with something better: task flag? or is there already an existing mechanism? Signed-off-by: Josh Poimboeuf --- include/linux/sched.h | 11 ++- kernel/sched/core.c | 26 -- 2 files