svn commit: r362890 - head/sys/kern

Mateusz Guzik mjg at FreeBSD.org
Thu Jul 2 12:58:07 UTC 2020


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--;


More information about the svn-src-head mailing list