From owner-svn-src-head@freebsd.org Fri Nov 17 02:22:52 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AFE65DF1089; Fri, 17 Nov 2017 02:22:52 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6ECCD7564D; Fri, 17 Nov 2017 02:22:52 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vAH2MpOp046761; Fri, 17 Nov 2017 02:22:51 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vAH2Mpjx046759; Fri, 17 Nov 2017 02:22:51 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201711170222.vAH2Mpjx046759@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Fri, 17 Nov 2017 02:22:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r325919 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 325919 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Nov 2017 02:22:52 -0000 Author: mjg Date: Fri Nov 17 02:22:51 2017 New Revision: 325919 URL: https://svnweb.freebsd.org/changeset/base/325919 Log: locks: pull up PMC_SOFT_CALLs out of slow path loops Modified: head/sys/kern/kern_rwlock.c head/sys/kern/kern_sx.c Modified: head/sys/kern/kern_rwlock.c ============================================================================== --- head/sys/kern/kern_rwlock.c Fri Nov 17 02:21:24 2017 (r325918) +++ head/sys/kern/kern_rwlock.c Fri Nov 17 02:22:51 2017 (r325919) @@ -443,6 +443,12 @@ __rw_rlock_hard(volatile uintptr_t *c, struct thread * #endif rw = rwlock2rw(c); +#ifdef HWPMC_HOOKS + PMC_SOFT_CALL( , , lock, failed); +#endif + lock_profile_obtain_lock_failed(&rw->lock_object, + &contested, &waittime); + #ifdef LOCK_PROFILING doing_lockprof = 1; state = v; @@ -460,11 +466,6 @@ __rw_rlock_hard(volatile uintptr_t *c, struct thread * #ifdef KDTRACE_HOOKS lda.spin_cnt++; #endif -#ifdef HWPMC_HOOKS - PMC_SOFT_CALL( , , lock, failed); -#endif - lock_profile_obtain_lock_failed(&rw->lock_object, - &contested, &waittime); #ifdef ADAPTIVE_RWLOCKS /* @@ -890,6 +891,12 @@ __rw_wlock_hard(volatile uintptr_t *c, uintptr_t v, ui CTR5(KTR_LOCK, "%s: %s contested (lock=%p) at %s:%d", __func__, rw->lock_object.lo_name, (void *)rw->rw_lock, file, line); +#ifdef HWPMC_HOOKS + PMC_SOFT_CALL( , , lock, failed); +#endif + lock_profile_obtain_lock_failed(&rw->lock_object, + &contested, &waittime); + #ifdef LOCK_PROFILING doing_lockprof = 1; state = v; @@ -910,11 +917,7 @@ __rw_wlock_hard(volatile uintptr_t *c, uintptr_t v, ui #ifdef KDTRACE_HOOKS lda.spin_cnt++; #endif -#ifdef HWPMC_HOOKS - PMC_SOFT_CALL( , , lock, failed); -#endif - lock_profile_obtain_lock_failed(&rw->lock_object, - &contested, &waittime); + #ifdef ADAPTIVE_RWLOCKS /* * If the lock is write locked and the owner is Modified: head/sys/kern/kern_sx.c ============================================================================== --- head/sys/kern/kern_sx.c Fri Nov 17 02:21:24 2017 (r325918) +++ head/sys/kern/kern_sx.c Fri Nov 17 02:22:51 2017 (r325919) @@ -551,6 +551,12 @@ _sx_xlock_hard(struct sx *sx, uintptr_t x, uintptr_t t CTR5(KTR_LOCK, "%s: %s contested (lock=%p) at %s:%d", __func__, sx->lock_object.lo_name, (void *)sx->sx_lock, file, line); +#ifdef HWPMC_HOOKS + PMC_SOFT_CALL( , , lock, failed); +#endif + lock_profile_obtain_lock_failed(&sx->lock_object, &contested, + &waittime); + #ifdef LOCK_PROFILING extra_work = 1; state = x; @@ -571,11 +577,6 @@ _sx_xlock_hard(struct sx *sx, uintptr_t x, uintptr_t t #ifdef KDTRACE_HOOKS lda.spin_cnt++; #endif -#ifdef HWPMC_HOOKS - PMC_SOFT_CALL( , , lock, failed); -#endif - lock_profile_obtain_lock_failed(&sx->lock_object, &contested, - &waittime); #ifdef ADAPTIVE_SX /* * If the lock is write locked and the owner is @@ -889,6 +890,12 @@ _sx_slock_hard(struct sx *sx, int opts, const char *fi lock_delay_arg_init(&lda, NULL); #endif +#ifdef HWPMC_HOOKS + PMC_SOFT_CALL( , , lock, failed); +#endif + lock_profile_obtain_lock_failed(&sx->lock_object, &contested, + &waittime); + #ifdef LOCK_PROFILING extra_work = 1; state = x; @@ -910,12 +917,6 @@ _sx_slock_hard(struct sx *sx, int opts, const char *fi #ifdef KDTRACE_HOOKS lda.spin_cnt++; #endif - -#ifdef HWPMC_HOOKS - PMC_SOFT_CALL( , , lock, failed); -#endif - lock_profile_obtain_lock_failed(&sx->lock_object, &contested, - &waittime); #ifdef ADAPTIVE_SX /*