From owner-p4-projects@FreeBSD.ORG Wed Nov 2 17:29:52 2005 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 8A45716A421; Wed, 2 Nov 2005 17:29:51 +0000 (GMT) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4960116A420 for ; Wed, 2 Nov 2005 17:29:51 +0000 (GMT) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 33F1143D62 for ; Wed, 2 Nov 2005 17:29:48 +0000 (GMT) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id jA2HTlOB095810 for ; Wed, 2 Nov 2005 17:29:48 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id jA2HTleT095807 for perforce@freebsd.org; Wed, 2 Nov 2005 17:29:47 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Date: Wed, 2 Nov 2005 17:29:47 GMT Message-Id: <200511021729.jA2HTleT095807@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to bb+lists.freebsd.perforce@cyrus.watson.org using -f From: Robert Watson To: Perforce Change Reviews Cc: Subject: PERFORCE change 86239 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Nov 2005 17:29:52 -0000 http://perforce.freebsd.org/chv.cgi?CH=86239 Change 86239 by rwatson@rwatson_zoo on 2005/11/02 17:29:20 When hinted not to preempt, also don't IPI. Affected files ... .. //depot/projects/netsmp/src/sys/kern/sched_4bsd.c#3 edit Differences ... ==== //depot/projects/netsmp/src/sys/kern/sched_4bsd.c#3 (text+ko) ==== @@ -1159,29 +1159,40 @@ cpu = NOCPU; ke->ke_runq = &runq; } - - if (single_cpu && (cpu != PCPU_GET(cpuid))) { - kick_other_cpu(td->td_priority,cpu); - } else { - - if (!single_cpu) { - cpumask_t me = PCPU_GET(cpumask); - int idle = idle_cpus_mask & me; + + /* + * Once we've established where to schedule the thread, we have to + * decide if we want to preempt the current thread, or IPI another + * CPU to start immediate execution there. + * + * Currently, suppressing preemption on the scheduling also + * suppresses IPIs to shedule on another CPU, as it is assumed that + * starting the thread running at once will result in poor timing of + * events, lock contention, etc. + */ + if (!(flags & SRQ_NOPREEMPT)) { + if (single_cpu && (cpu != PCPU_GET(cpuid))) { + kick_other_cpu(td->td_priority,cpu); + } else { + if (!single_cpu) { + cpumask_t me = PCPU_GET(cpumask); + int idle = idle_cpus_mask & me; - if (!idle && ((flags & SRQ_INTR) == 0) && - (idle_cpus_mask & ~(hlt_cpus_mask | me))) - forwarded = forward_wakeup(cpu); - } + if (!idle && ((flags & SRQ_INTR) == 0) && + (idle_cpus_mask & ~(hlt_cpus_mask | me))) + forwarded = forward_wakeup(cpu); + } - if (!forwarded) { - if ((flags & SRQ_YIELDING) == 0 && - (flags & SRQ_NOPREEMPT) == 0 && - maybe_preempt(td)) - return; - else - maybe_resched(td); + if (!forwarded) { + if ((flags & SRQ_YIELDING) == 0 && + maybe_preempt(td)) + return; + else + maybe_resched(td); + } } - } + } else + maybe_resched(td); if ((td->td_proc->p_flag & P_NOLOAD) == 0) sched_load_add();