1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-02 08:42:48 +00:00

Modernize geom_stats_snapshot_get

* A logically useless memset() is used to fault in some memory pages.
  Change it to explicit_bzero so the compiler won't eliminate it.

* Eliminate the second memset.  It made sense in the days of the Big
  Kernel Lock, but not in the days of fine-grained SMP and especially
  not in the days of VDSO.

MFC after:	2 weeks
Sponsored by:	Axcient
Reviewed by:	phk
Differential Revision:	https://reviews.freebsd.org/D29047
This commit is contained in:
Alan Somers 2021-03-03 13:06:38 -07:00
parent 63749bfe96
commit f05b724ecb

View File

@ -136,9 +136,8 @@ geom_stats_snapshot_get(void)
free(sp);
return (NULL);
}
memset(sp->ptr, 0, pagesize * npages); /* page in, cache */
explicit_bzero(sp->ptr, pagesize * npages); /* page in, cache */
clock_gettime(CLOCK_REALTIME, &sp->time);
memset(sp->ptr, 0, pagesize * npages); /* page in, cache */
memcpy(sp->ptr, statp, pagesize * npages);
sp->pages = npages;
sp->perpage = spp;