Re: [PATCH for 2.5] preemptible kernel

Rusty Russell
2001-04-05T07:59:18Z

In message <Pine.LNX.4.05.10104011347060.14420-100000@cosmic.nrg.org> you write
:
> > Setting a running task's flags brings races, AFAICT, and checking
> > p->state is NOT sufficient, consider wait_event(): you need p->has_cpu
> > here I think.
>
> My thought here was that if p->state is anything other than TASK_RUNNING
> or TASK_RUNNING|TASK_PREEMPTED, then that task is already at a
> synchonize point,

Right. Theoretically possible to set p->state and not sleep, but it's
not a bad assumption.

> > schedule():
> > if (!(prev->state & TASK_PREEMPTED) && prev->syncing)
> > if (--sync_count == 0) wake_up(&syncing_task);
>
> Don't forget to reset prev->syncing.

Right.

> I agree with you about wait queues, but didn't use them here because
> of the problem of avoiding deadlock on the runqueue lock, which the
> wait queues also use.

And right again. Yeah, it has to be done manually. Ack, can I
retract that Email?

Rusty.
--
Premature optmztion is rt of all evl. --DK