Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 2 Jul 2020 12:58:07 +0000 (UTC)
From:      Mateusz Guzik <mjg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r362890 - head/sys/kern
Message-ID:  <202007021258.062Cw7Av087050@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mjg
Date: Thu Jul  2 12:58:07 2020
New Revision: 362890
URL: https://svnweb.freebsd.org/changeset/base/362890

Log:
  cred: add a prediction to crfree for td->td_realucred == cr
  
  This matches crhold and eliminates an assembly maze in the common case.

Modified:
  head/sys/kern/kern_prot.c

Modified: head/sys/kern/kern_prot.c
==============================================================================
--- head/sys/kern/kern_prot.c	Thu Jul  2 12:56:20 2020	(r362889)
+++ head/sys/kern/kern_prot.c	Thu Jul  2 12:58:07 2020	(r362890)
@@ -1985,7 +1985,7 @@ crfree(struct ucred *cr)
 	struct thread *td;
 
 	td = curthread;
-	if (td->td_realucred == cr) {
+	if (__predict_true(td->td_realucred == cr)) {
 		KASSERT(cr->cr_users > 0, ("%s: users %d not > 0 on cred %p",
 		    __func__, cr->cr_users, cr));
 		td->td_ucredref--;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202007021258.062Cw7Av087050>