From owner-p4-projects@FreeBSD.ORG Fri Sep 10 21:34:14 2004 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 986F616A4D0; Fri, 10 Sep 2004 21:34:14 +0000 (GMT) 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 5D5B816A4CE for ; Fri, 10 Sep 2004 21:34:14 +0000 (GMT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4111E43D45 for ; Fri, 10 Sep 2004 21:34:14 +0000 (GMT) (envelope-from julian@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.11/8.12.11) with ESMTP id i8ALYEje069705 for ; Fri, 10 Sep 2004 21:34:14 GMT (envelope-from julian@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.11/8.12.11/Submit) id i8ALYDYC069702 for perforce@freebsd.org; Fri, 10 Sep 2004 21:34:13 GMT (envelope-from julian@freebsd.org) Date: Fri, 10 Sep 2004 21:34:13 GMT Message-Id: <200409102134.i8ALYDYC069702@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to julian@freebsd.org using -f From: Julian Elischer To: Perforce Change Reviews Subject: PERFORCE change 61313 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2004 21:34:15 -0000 http://perforce.freebsd.org/chv.cgi?CH=61313 Change 61313 by julian@julian_ref on 2004/09/10 21:33:12 Stop being schitzophrenic about where cpu pinning happens. Affected files ... .. //depot/projects/nsched/sys/i386/i386/pmap.c#19 edit .. //depot/projects/nsched/sys/kern/sched_4bsd.c#42 edit .. //depot/projects/nsched/sys/kern/sched_ule.c#25 edit .. //depot/projects/nsched/sys/sys/proc.h#27 edit .. //depot/projects/nsched/sys/sys/sched.h#15 edit Differences ... ==== //depot/projects/nsched/sys/i386/i386/pmap.c#19 (text+ko) ==== @@ -807,7 +807,7 @@ if (pmap_is_current(pmap)) return (vtopte(va)); mtx_assert(&vm_page_queue_mtx, MA_OWNED); - KASSERT(curthread->td_pinned > 0, ("curthread not pinned")); + KASSERT(sched_ispinned(), ("curthread not pinned")); newpf = *pde & PG_FRAME; if ((*PMAP1 & PG_FRAME) != newpf) { *PMAP1 = newpf | PG_RW | PG_V | PG_A | PG_M; @@ -1622,7 +1622,7 @@ pt_entry_t *pte; mtx_assert(&vm_page_queue_mtx, MA_OWNED); - KASSERT(curthread->td_pinned > 0, ("curthread not pinned")); + KASSERT(sched_ispinned(), ("curthread not pinned")); PMAP_LOCK_ASSERT(pmap, MA_OWNED); if ((pte = pmap_pte_quick(pmap, va)) == NULL || *pte == 0) return; ==== //depot/projects/nsched/sys/kern/sched_4bsd.c#42 (text+ko) ==== @@ -87,7 +87,7 @@ } ke_state; /* (j) KSE status. */ int ke_cpticks; /* (j) Ticks of cpu time. */ struct runq *ke_runq; /* runq the kse is currently on */ - int ke_pinned; /* nested count of pinned to a cpu */ + int ke_pinned; /* (k) nested count, pinned to a cpu */ }; #define ke_proc ke_thread->td_proc @@ -1173,5 +1173,26 @@ return (0); } + +void +sched_pin(void) +{ + curthread->td_sched->ke_pinned++ +} + + void +sched_unpin(void) +{ + curthread->td_sched->ke_pinned--; +} + +#ifdef INVARIANTS +int +sched_ispinned(void) +{ + return (curthread->td_sched->ke_pinned) +} +#endif + #define KERN_SWITCH_INCLUDE 1 #include "kern/kern_switch.c" ==== //depot/projects/nsched/sys/kern/sched_ule.c#25 (text+ko) ==== @@ -112,7 +112,7 @@ KES_ONRUNQ } ke_state; /* (j) thread sched specific status. */ int ke_slptime; - int ke_pinned; + int ke_pinned; /* (k) nested coult.. pinned to a cpu */ int ke_slice; struct runq *ke_runq; u_char ke_cpu; /* CPU that we have affinity for. */ @@ -1902,5 +1902,26 @@ { return (sizeof(struct thread) + sizeof(struct td_sched)); } + +void +sched_pin(void) +{ + curthread->td_sched->ke_pinned++ +} + + void +sched_unpin(void) +{ + curthread->td_sched->td_pinned--; +} + +#ifdef INVARIANTS +int +sched_ispinned(void) +{ + return (curthread->td_sched->ke_pinned) +} +#endif + #define KERN_SWITCH_INCLUDE 1 #include "kern/kern_switch.c" ==== //depot/projects/nsched/sys/sys/proc.h#27 (text+ko) ==== @@ -268,7 +268,6 @@ LIST_HEAD(, turnstile) td_contested; /* (q) Contested locks. */ struct lock_list_entry *td_sleeplocks; /* (k) Held sleep locks. */ int td_intr_nesting_level; /* (k) Interrupt recursion. */ - int td_pinned; /* (k) Temporary cpu pin count. */ struct kse_thr_mailbox *td_mailbox; /* (*) Userland mailbox address. */ struct ucred *td_ucred; /* (k) Reference to credentials. */ struct thread *td_standin; /* (*) Use this for an upcall. */ ==== //depot/projects/nsched/sys/sys/sched.h#15 (text+ko) ==== @@ -82,11 +82,16 @@ * hold a thread on a particular CPU. */ void sched_bind(struct thread *td, int cpu); -static __inline void sched_pin(void); void sched_unbind(struct thread *td); -static __inline void sched_unpin(void); +/* these only work for curthread */ +void sched_pin(void); +void sched_unpin(void); +#ifdef INVARIANTS +int sched_ispinned(void); +#endif + /* * These procedures tell the process data structure allocation code how * many bytes to actually allocate. @@ -95,18 +100,6 @@ int sched_sizeof_proc(void); int sched_sizeof_thread(void); -static __inline void -sched_pin(void) -{ - curthread->td_pinned++; -} - -static __inline void -sched_unpin(void) -{ - curthread->td_pinned--; -} - /* temporarily here */ void schedinit(void); void sched_destroyproc(struct proc *p);