Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 25 Feb 2006 20:04:01 +0900
From:      Kazuaki Oda <kaakun@highway.ne.jp>
To:        freebsd-hackers@freebsd.org
Subject:   question about preemption code
Message-ID:  <440039A1.9030500@highway.ne.jp>

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

When reading kern_switch.c, I noticed odd difference between !SMP and
SMP in maybe_preempt_in_ksegrp().

In !SMP case:
=================================================================
#ifdef PREEMPTION
#ifndef FULL_PREEMPTION
	if (td->td_priority > PRI_MAX_ITHD) {
		running_thread->td_flags |= TDF_NEEDRESCHED;
		return;
	}
#endif /* FULL_PREEMPTION */
=================================================================

In SMP case:
=================================================================
#ifdef PREEMPTION

#if !defined(FULL_PREEMPTION)
	if (td->td_priority > PRI_MAX_ITHD) {
		running_thread->td_flags |= TDF_NEEDRESCHED;
	}
#endif /* ! FULL_PREEMPTION */
=================================================================

Is there any reason not to return after setting TDF_NEEDRESCHED flag
in SMP case?  Because of this, we do context switch even if td's
priority is lower than PRI_MAX_ITHD.  And, I think, it is not
PREEMPTION, but FULL_PREEMPTION.

----
Kazuaki Oda



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?440039A1.9030500>