Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 Dec 2010 16:22:24 +0800
From:      David Xu <davidxu@freebsd.org>
To:        John Baldwin <jhb@freebsd.org>, Julian Elischer <julian@elischer.org>, arch@freebsd.org
Subject:   TDF_NEEDRESCHED (was: Realtime thread priorities)
Message-ID:  <4D1AEFC0.7030400@freebsd.org>

next in thread | raw e-mail | index | archive | help
Hi all,

I think flag TDF_NEEDRESCHED should not be cleared by sched_switch() in
ULE or 4BSD, instead it should only be cleared by ast() in subr_trap.c.
The reason is that the flag indicates thread should reset its priority
and switch context at user boundary because its user mode priority is
lowered or there is higher priority thread wants to run.
Kernel needs to use this flag to reset its priority to td_user_pri
before a thread returns to user mode, in current code, if an interrupt
thread preempts a user thread, sched_switch() clears the flag for
preempted thread and then switches to preempting thread, this causes
preempted thread to forget resetting its current priority to td_user_pri
this becauses assemble language code doreti() can not find the flag,
and ast() is not called, the thread ends up running user mode code
at very high level priority. Fix me, if I am wrong.

Regards,
David Xu




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4D1AEFC0.7030400>