Add pg_memory_is_all_zeros() in memutils.h
Michael Paquier <michael@paquier.xyz>
Add pg_memory_is_all_zeros() in memutils.h This new function tests if a memory region starting at a given location for a defined length is made only of zeroes. This unifies in a single path the all-zero checks that were happening in a couple of places of the backend code: - For pgstats entries of relation, checkpointer and bgwriter, where some "all_zeroes" variables were previously used with memcpy(). - For all-zero buffer pages in PageIsVerifiedExtended(). This new function uses the same forward scan as the check for all-zero buffer pages, applying it to the three pgstats paths mentioned above. Author: Bertrand Drouvot Reviewed-by: Peter Eisentraut, Heikki Linnakangas, Peter Smith Discussion: https://postgr.es/m/ZupUDDyf1hHI4ibn@ip-10-97-1-34.eu-west-3.compute.internal
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/storage/page/bufpage.c | modified | +1 −12 |
| src/backend/utils/activity/pgstat_bgwriter.c | modified | +3 −2 |
| src/backend/utils/activity/pgstat_checkpointer.c | modified | +3 −4 |
| src/backend/utils/activity/pgstat_relation.c | modified | +2 −5 |
| src/include/utils/memutils.h | modified | +17 −0 |
Discussion
- define pg_structiszero(addr, s, r) 96 messages · 2024-09-18 → 2024-11-18