Re: define pg_structiszero(addr, s, r)
Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
From: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
To: Michael Paquier <michael@paquier.xyz>
Cc: Peter Smith <smithpb2250@gmail.com>, Peter Eisentraut <peter@eisentraut.org>, Heikki Linnakangas <hlinnaka@iki.fi>, pgsql-hackers@lists.postgresql.org
Date: 2024-10-31T05:52:49Z
Lists: pgsql-hackers
Attachments
Hi, On Thu, Oct 31, 2024 at 09:59:35AM +0900, Michael Paquier wrote: > On Thu, Oct 31, 2024 at 07:55:45AM +1100, Peter Smith wrote: > > +/* > > + * Test if a memory region starting at p and of size len is full of zeroes. > > + */ > > +static inline bool > > +pg_mem_is_all_zeros(const void *ptr, size_t len) > > > > The function comment should say 'ptr' instead of 'p', right? > > Yes. Thank you both for looking at it. Agree, done in the new version attached. > +static inline bool > +pg_mem_is_all_zeros(const void *ptr, size_t len) > > While we're talking about wordsmithing things, I would not choose > "mem" for this routine, just stick to "memory". There is not much in > the code that does memory-specific things like what you are proposing > here. Still, this would be more consistent with the macros for memory > barriers at least. Hence, "pg_memory_is_all_zeros()" makes more > sense? That makes sense to me, done that way in the attached. > The location of memutils.h is sensible. Thanks for sharing your thoughts on it. > + if (pg_mem_is_all_zeros(pagebytes , (BLCKSZ / sizeof(size_t)))) > > Extra space not required after pagebytes. Fat finger here, thanks! Regards, -- Bertrand Drouvot PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com
Commits
-
Use pg_memory_is_all_zeros() in PageIsVerifiedExtended()
- 03a42c9652f8 18.0 landed
-
Optimize pg_memory_is_all_zeros() in memutils.h
- 5be1dabd2ae0 18.0 landed
-
Remove use of pg_memory_is_all_zeros() in bufpage.c
- e819bbb7c82a 18.0 landed
-
Add pg_memory_is_all_zeros() in memutils.h
- 07e9e28b56db 18.0 landed