From owner-freebsd-hackers@FreeBSD.ORG Sat Feb 25 11:06:29 2006 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2622A16A420 for ; Sat, 25 Feb 2006 11:06:29 +0000 (GMT) (envelope-from kaakun@highway.ne.jp) Received: from mx.highway.ne.jp (pip7.gate01.com [61.122.117.245]) by mx1.FreeBSD.org (Postfix) with ESMTP id D5BC843D46 for ; Sat, 25 Feb 2006 11:06:28 +0000 (GMT) (envelope-from kaakun@highway.ne.jp) Received: from [219.0.96.106] (helo=[192.168.11.18]) by pop12.isp.us-com.jp with esmtp (Mail 4.20) id 1FCxFr-0005U7-CF for freebsd-hackers@freebsd.org; Sat, 25 Feb 2006 20:06:27 +0900 Message-ID: <440039A1.9030500@highway.ne.jp> Date: Sat, 25 Feb 2006 20:04:01 +0900 From: Kazuaki Oda User-Agent: Mozilla Thunderbird 1.0.7 (X11/20051211) X-Accept-Language: en-us, en MIME-Version: 1.0 To: freebsd-hackers@freebsd.org Content-Type: text/plain; charset=ISO-2022-JP Content-Transfer-Encoding: 7bit Subject: question about preemption code X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Feb 2006 11:06:29 -0000 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