Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1375619

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

From Petr Mladek <pmladek@suse.com>
Newsgroups linux.kernel
Subject Re: sched: horrible way to detect whether a task has been preempted
Date 2016-04-11 10:40 +0200
Message-ID <rmFy3-2Qu-33@gated-at.bofh.it> (permalink)
References (3 earlier) <rlpOG-1Do-9@gated-at.bofh.it> <rlrnr-2VG-11@gated-at.bofh.it> <rlyIi-bh-11@gated-at.bofh.it> <rlzEm-Px-9@gated-at.bofh.it> <rlFJL-5dc-17@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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 migrating a task and it is
> > charged to a separate process.
> 
> My biggest concern about checking the stack for preempt_schedule_irq()
> is that it's kind of brittle:
> 
> - What if the preemption code changes such that it's no longer a
>   reliable indicator?  For example, what if preempt_schedule_irq() is
>   only called in some places, and a new __preempt_schedule_irq() is
>   called elsewhere?
> 
> - Or due to some obscure gcc optimization like partial inlining or
>   sibling tail calls, preempt_schedule_irq() doesn't show up on the
>   stack?  
> 
> - Or the code could silently break if there were another static
>   preempt_schedule_irq symbol somewhere (though we could prevent this by
>   searching all symbols to ensure there are no duplicates).
> 
> These scenarios are unlikely, but they could conceivably happen...

You are right.

> Anyway, we really wouldn't have to eat a TIF flag.  We could instead add
> something to task_struct.  I can at least propose it.  If anybody
> doesn't like it, maybe they'll suggest something else, or maybe then we
> can go with checking the stack.

Yup, we should give the extra task struct stuff a try. Another
advantage is that it would be easier to port for another
architectures.

Best Regards,
Petr

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Re: sched: horrible way to detect whether a task has been preempted Jessica Yu <jeyu@redhat.com> - 2016-04-07 23:20 +0200
  Re: sched: horrible way to detect whether a task has been  preempted Jiri Kosina <jikos@kernel.org> - 2016-04-07 23:40 +0200
    Re: sched: horrible way to detect whether a task has been preempted Josh Poimboeuf <jpoimboe@redhat.com> - 2016-04-08 00:40 +0200
      Re: sched: horrible way to detect whether a task has been  preempted Jiri Kosina <jikos@kernel.org> - 2016-04-08 01:00 +0200
    Re: sched: horrible way to detect whether a task has been preempted Jessica Yu <jeyu@redhat.com> - 2016-04-08 01:20 +0200
      Re: sched: horrible way to detect whether a task has been  preempted Jiri Kosina <jikos@kernel.org> - 2016-04-08 09:10 +0200
        Re: sched: horrible way to detect whether a task has been preempted Petr Mladek <pmladek@suse.com> - 2016-04-08 10:10 +0200
          Re: sched: horrible way to detect whether a task has been preempted Josh Poimboeuf <jpoimboe@redhat.com> - 2016-04-08 16:40 +0200
            Re: sched: horrible way to detect whether a task has been preempted Petr Mladek <pmladek@suse.com> - 2016-04-11 10:40 +0200

csiph-web