From owner-p4-projects Fri Jun 7 7:22:43 2002 Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id E562D37B403; Fri, 7 Jun 2002 07:22:36 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 4C01137B412 for ; Fri, 7 Jun 2002 07:22:28 -0700 (PDT) Received: (from perforce@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id g57EMSw16255 for perforce@freebsd.org; Fri, 7 Jun 2002 07:22:28 -0700 (PDT) (envelope-from jhb@freebsd.org) Date: Fri, 7 Jun 2002 07:22:28 -0700 (PDT) Message-Id: <200206071422.g57EMSw16255@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: perforce set sender to jhb@freebsd.org using -f From: John Baldwin Subject: PERFORCE change 12492 for review To: Perforce Change Reviews Sender: owner-p4-projects@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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