From owner-p4-projects Fri Nov 1 11:11:28 2002 Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 0F28737B404; Fri, 1 Nov 2002 11:11:26 -0800 (PST) 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 AC46937B401 for ; Fri, 1 Nov 2002 11:11:25 -0800 (PST) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 69CCE43E8A for ; Fri, 1 Nov 2002 11:11:25 -0800 (PST) (envelope-from jhb@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.6/8.12.6) with ESMTP id gA1J9xmV036755 for ; Fri, 1 Nov 2002 11:09:59 -0800 (PST) (envelope-from jhb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.6/8.12.6/Submit) id gA1J9weB036750 for perforce@freebsd.org; Fri, 1 Nov 2002 11:09:58 -0800 (PST) Date: Fri, 1 Nov 2002 11:09:58 -0800 (PST) Message-Id: <200211011909.gA1J9weB036750@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jhb@freebsd.org using -f From: John Baldwin Subject: PERFORCE change 20531 for review To: Perforce Change Reviews Sender: owner-p4-projects@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG http://perforce.freebsd.org/chv.cgi?CH=20531 Change 20531 by jhb@jhb_laptop on 2002/11/01 11:09:10 A few extra points for readability. Affected files ... .. //depot/projects/smpng/sys/kern/kern_mutex.c#54 edit Differences ... ==== //depot/projects/smpng/sys/kern/kern_mutex.c#54 (text+ko) ==== @@ -481,14 +481,16 @@ _mtx_lock_sleep(struct mtx *m, int opts, const char *file, int line) { struct thread *td = curthread; + struct thread *td1; #if defined(SMP) && defined(ADAPTIVE_MUTEXES) struct thread *owner; #endif + uintptr_t v; #ifdef KTR int cont_logged = 0; #endif - if ((m->mtx_lock & MTX_FLAGMASK) == (uintptr_t)td) { + if (mtx_owned(m)) { m->mtx_recurse++; atomic_set_ptr(&m->mtx_lock, MTX_RECURSED); if (LOCK_LOG_TEST(&m->mtx_object, opts)) @@ -502,15 +504,15 @@ m->mtx_object.lo_name, (void *)m->mtx_lock, file, line); while (!_obtain_lock(m, td)) { - uintptr_t v; - struct thread *td1; mtx_lock_spin(&sched_lock); + v = m->mtx_lock; + /* * Check if the lock has been released while spinning for * the sched_lock. */ - if ((v = m->mtx_lock) == MTX_UNOWNED) { + if (v == MTX_UNOWNED) { mtx_unlock_spin(&sched_lock); #ifdef __i386__ ia32_pause(); To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe p4-projects" in the body of the message