Re: [PATCH for 2.5] preemptible kernel

Rusty Russell (rusty@rustcorp.com.au)
Thu, 05 Apr 2001 03:51:11 +1000


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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/