svn commit: r312991 - head/sys/kern

Andriy Gapon avg at FreeBSD.org
Mon Jan 30 15:20:15 UTC 2017


Author: avg
Date: Mon Jan 30 15:20:13 2017
New Revision: 312991
URL: https://svnweb.freebsd.org/changeset/base/312991

Log:
  put very expensive sanity checks of advisory locks under DIAGNOSTIC
  
  The checks have quadratic complexity over a number of advisory locks
  active for a file and that could be a lot.  What's the worse is that the
  checks are done while holding ls_lock.  That could lead to a long a very
  long backlog and performance degradation even if all requested locks are
  compatible (e.g. all shared locks).
  
  The checks used to be under INVARIANTS.
  
  Discussed with:	kib
  MFC after:	2 weeks
  Sponsored by:	Panzura

Modified:
  head/sys/kern/kern_lockf.c

Modified: head/sys/kern/kern_lockf.c
==============================================================================
--- head/sys/kern/kern_lockf.c	Mon Jan 30 14:34:04 2017	(r312990)
+++ head/sys/kern/kern_lockf.c	Mon Jan 30 15:20:13 2017	(r312991)
@@ -689,7 +689,7 @@ retry_setlock:
 		break;
 	}
 
-#ifdef INVARIANTS
+#ifdef DIAGNOSTIC
 	/*
 	 * Check for some can't happen stuff. In this case, the active
 	 * lock list becoming disordered or containing mutually
@@ -917,7 +917,7 @@ lf_add_edge(struct lockf_entry *x, struc
 	struct lockf_edge *e;
 	int error;
 
-#ifdef INVARIANTS
+#ifdef DIAGNOSTIC
 	LIST_FOREACH(e, &x->lf_outedges, le_outlink)
 		KASSERT(e->le_to != y, ("adding lock edge twice"));
 #endif


More information about the svn-src-all mailing list