Date: Fri, 10 Sep 2004 21:34:13 GMT From: Julian Elischer <julian@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 61313 for review Message-ID: <200409102134.i8ALYDYC069702@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200409102134.i8ALYDYC069702>