Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 7 Jun 2002 07:22:28 -0700 (PDT)
From:      John Baldwin <jhb@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 12492 for review
Message-ID:  <200206071422.g57EMSw16255@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://people.freebsd.org/~peter/p4db/chv.cgi?CH=12492

Change 12492 by jhb@jhb_laptop on 2002/06/07 07:22:04

	- If a witness was never used (no locks it was attached to were
	  ever acquired, thus, w_file == NULL) then return it to the free
	  list when it becomes dead.
	- Rate limit the dead witness message to one message per witness
	  object so we don't spam the console.

Affected files ...

... //depot/projects/smpng/sys/kern/subr_witness.c#54 edit

Differences ...

==== //depot/projects/smpng/sys/kern/subr_witness.c#54 (text+ko) ====

@@ -98,6 +98,7 @@
 	u_char	w_Giant_squawked:1;
 	u_char	w_other_squawked:1;
 	u_char	w_same_squawked:1;
+	u_char	w_dead_squawked:1;
 };
 
 struct witness_child_list_entry {
@@ -369,6 +370,7 @@
 witness_destroy(struct lock_object *lock)
 {
 	struct witness *w;
+	int print;
 
 	if (witness_cold)
 		panic("lock (%s) %s destroyed while witness_cold",
@@ -383,8 +385,21 @@
 		mtx_lock_spin(&w_mtx);
 		MPASS(w->w_refcount > 0);
 		w->w_refcount--;
+		print = 0;
+		if (w->w_refcount == 0) {
+			/*
+			 * If no locks for this witness were ever acquired,
+			 * then return the witness to the free list.
+			 */
+			if (w->w_file == NULL)
+				witness_free(w);
+			else if (w->w_dead_squawked == 0) {
+				w->w_dead_squawked = 1;
+				print = 1;
+			}
+		}
 		mtx_unlock_spin(&w_mtx);
-		if (w->w_refcount == 0)
+		if (print)
 			printf("dead witness: %s\n", w->w_name);
 	}
 

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe p4-projects" in the body of the message




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