From owner-svn-src-all@freebsd.org Sun Jan 12 06:09:10 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D15AF2254B9; Sun, 12 Jan 2020 06:09:10 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47wRBG4vShz424w; Sun, 12 Jan 2020 06:09:10 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A3887F49D; Sun, 12 Jan 2020 06:09:10 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 00C69AW6050820; Sun, 12 Jan 2020 06:09:10 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 00C69Anp050819; Sun, 12 Jan 2020 06:09:10 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202001120609.00C69Anp050819@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sun, 12 Jan 2020 06:09:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356656 - in head/sys: kern sys X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: in head/sys: kern sys X-SVN-Commit-Revision: 356656 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Jan 2020 06:09:10 -0000 Author: mjg Date: Sun Jan 12 06:09:10 2020 New Revision: 356656 URL: https://svnweb.freebsd.org/changeset/base/356656 Log: Add "panicked" boolean which can be tested instead of panicstr The test is performed all the time and reading entire panicstr to do it wastes space. Modified: head/sys/kern/kern_shutdown.c head/sys/sys/systm.h Modified: head/sys/kern/kern_shutdown.c ============================================================================== --- head/sys/kern/kern_shutdown.c Sun Jan 12 06:07:54 2020 (r356655) +++ head/sys/kern/kern_shutdown.c Sun Jan 12 06:09:10 2020 (r356656) @@ -217,7 +217,8 @@ SYSCTL_INT(_kern, OID_AUTO, kerneldump_gzlevel, CTLFLA * Variable panicstr contains argument to first call to panic; used as flag * to indicate that the kernel has already called panic. */ -const char __read_mostly *panicstr; +const char *panicstr; +bool __read_frequently panicked; int __read_mostly dumping; /* system is dumping */ int rebooting; /* system is rebooting */ @@ -873,6 +874,7 @@ vpanic(const char *fmt, va_list ap) else { bootopt |= RB_DUMP; panicstr = fmt; + panicked = true; newpanic = 1; } Modified: head/sys/sys/systm.h ============================================================================== --- head/sys/sys/systm.h Sun Jan 12 06:07:54 2020 (r356655) +++ head/sys/sys/systm.h Sun Jan 12 06:09:10 2020 (r356656) @@ -53,7 +53,8 @@ extern int cold; /* nonzero if we are doing a cold bo extern int suspend_blocked; /* block suspend due to pending shutdown */ extern int rebooting; /* kern_reboot() has been called. */ extern const char *panicstr; /* panic message */ -#define KERNEL_PANICKED() __predict_false(panicstr != NULL) +extern bool panicked; +#define KERNEL_PANICKED() __predict_false(panicked) extern char version[]; /* system version */ extern char compiler_version[]; /* compiler version */ extern char copyright[]; /* system copyright */