On Sun, Jan 12, 2020 at 06:09:10AM +0000, Mateusz Guzik wrote: > 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. What space does it waste ? The space in the read-mostly section ?
And what is the difference between reading a pointer vs. reading a byte ? CPU still has to read the whole cache line. > > 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 */ _______________________________________________ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"