lkml.org 
[lkml]   [1998]   [Nov]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: prev->has_cpu


On Fri, 13 Nov 1998, Andrea Arcangeli wrote:
>
> >one. That always works - even if next == prev, in which case it doesn't
>
> If next == prev we don' t switch_to() another task. But the other task
> (not going to be scheduled yet) will just have next->has_cpu == 1 even if
> will not run soon. I think _only_ running (currents) tasks should have
> ->has_cpu == 1.

If "next == prev", then there _is_ no other task.

> >actually do anything. I don't see the problem: schedule() is always
> >guaranteed to be entered with "current->has_cpu == 1" (because otherwise
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> Where? I can' t find such piece of code. I think instead that if `prev ==
> next', we' ll exit from the scheule() without changing the current process
> and with current->has_cpu == 0.

No, "current->has_cpu" is _always_ 1 (except inside the scheduler itself,
when it can temporarily drop down to zero while we hold the scheduler
lock). The only case "next == prev" happens is when "current == next ==
prev".

"has_cpu" essentially means that it is actually physcially running on some
CPU.

Linus


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:45    [from the cache]
©2003-2011 Jasper Spaans