From owner-p4-projects@FreeBSD.ORG Sat Dec 1 23:07:34 2007 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id E555916A479; Sat, 1 Dec 2007 23:07:33 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8303916A46B for ; Sat, 1 Dec 2007 23:07:33 +0000 (UTC) (envelope-from peter@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 6AC3813C4F9 for ; Sat, 1 Dec 2007 23:07:33 +0000 (UTC) (envelope-from peter@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id lB1N7XaB091321 for ; Sat, 1 Dec 2007 23:07:33 GMT (envelope-from peter@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id lB1N7XkY091314 for perforce@freebsd.org; Sat, 1 Dec 2007 23:07:33 GMT (envelope-from peter@freebsd.org) Date: Sat, 1 Dec 2007 23:07:33 GMT Message-Id: <200712012307.lB1N7XkY091314@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to peter@freebsd.org using -f From: Peter Wemm To: Perforce Change Reviews Cc: Subject: PERFORCE change 129914 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: Sat, 01 Dec 2007 23:07:34 -0000 http://perforce.freebsd.org/chv.cgi?CH=129914 Change 129914 by peter@peter_daintree on 2007/12/01 23:07:09 move common code Affected files ... .. //depot/projects/bike_sched/sys/kern/sched_4bsd.c#10 edit .. //depot/projects/bike_sched/sys/kern/sched_ule.c#9 edit .. //depot/projects/bike_sched/sys/kern/subr_trap.c#5 edit Differences ... ==== //depot/projects/bike_sched/sys/kern/sched_4bsd.c#10 (text+ko) ==== @@ -1237,28 +1237,6 @@ } void -sched_userret(struct thread *td) -{ - /* - * XXX we cheat slightly on the locking here to avoid locking in - * the usual case. Setting td_priority here is essentially an - * incomplete workaround for not setting it properly elsewhere. - * Now that some interrupt handlers are threads, not setting it - * properly elsewhere can clobber it in the window between setting - * it here and returning to user mode, so don't waste time setting - * it perfectly here. - */ - KASSERT((td->td_flags & TDF_BORROWING) == 0, - ("thread with borrowed priority returning to userland")); - if (td->td_priority != td->td_user_pri) { - thread_lock(td); - td->td_priority = td->td_user_pri; - td->td_base_pri = td->td_user_pri; - thread_unlock(td); - } -} - -void sched_bind(struct thread *td, int cpu) { struct td_sched *ts; ==== //depot/projects/bike_sched/sys/kern/sched_ule.c#9 (text+ko) ==== @@ -2110,32 +2110,6 @@ } /* - * Fix priorities on return to user-space. Priorities may be elevated due - * to static priorities in msleep() or similar. - */ -void -sched_userret(struct thread *td) -{ - /* - * XXX we cheat slightly on the locking here to avoid locking in - * the usual case. Setting td_priority here is essentially an - * incomplete workaround for not setting it properly elsewhere. - * Now that some interrupt handlers are threads, not setting it - * properly elsewhere can clobber it in the window between setting - * it here and returning to user mode, so don't waste time setting - * it perfectly here. - */ - KASSERT((td->td_flags & TDF_BORROWING) == 0, - ("thread with borrowed priority returning to userland")); - if (td->td_priority != td->td_user_pri) { - thread_lock(td); - td->td_priority = td->td_user_pri; - td->td_base_pri = td->td_user_pri; - thread_unlock(td); - } -} - -/* * Handle a stathz tick. This is really only relevant for timeshare * threads. */ ==== //depot/projects/bike_sched/sys/kern/subr_trap.c#5 (text+ko) ==== @@ -120,8 +120,26 @@ if (p->p_flag & P_PROFIL) addupc_task(td, TRAPF_PC(frame), td->td_pticks * psratio); + /* + * Fix priorities on return to user-space. Priorities may be elevated due + * to static priorities in msleep() or similar. + * + * XXX we cheat slightly on the locking here to avoid locking in + * the usual case. Setting td_priority here is essentially an + * incomplete workaround for not setting it properly elsewhere. + * Now that some interrupt handlers are threads, not setting it + * properly elsewhere can clobber it in the window between setting + * it here and returning to user mode, so don't waste time setting + * it perfectly here. + */ KASSERT((td->td_flags & TDF_BORROWING) == 0, ("userret: thread with borrowed priority returning to userland")); + if (td->td_priority != td->td_user_pri) { + thread_lock(td); + td->td_priority = td->td_user_pri; + td->td_base_pri = td->td_user_pri; + thread_unlock(td); + } KASSERT(td->td_locks == 0, ("userret: Returning with %d locks held.", td->td_locks)); }