On 4/7/25 18:42, Andres Freund wrote: > ... >>> >>> Of course that would mean that we'd always need to >>> pg_numa_touch_mem_if_required(), not just the first time round, because we >>> previously might not have for a page that is now valid. But compared to the >>> cost of actually allocating pages, the cost for that seems small. >> >> I suppose by "range" you mean buffers on a given memory page > > Correct. > >> and "valid" means BufferIsValid. > > I was thinking of checking if the BufferDesc indicates BM_VALID or > BM_TAG_VALID. > > BufferIsValid() just does a range check :(. >
Well, I guess BufferIsValid() seems a tad confusing ... > >> Yeah, that probably means the memory page is allocated. But if the buffer is >> invalid, it does not mean the memory is not allocated, right? So does it >> make the buffer not interesting? > > Well, you don't have contents in it it can't really affect performance. But > yea, I agree, it's not perfect either. > > >> I think we need to decide whether the current patches are good enough >> for PG18, with the current behavior, and then maybe improve that in >> PG19. > > I think as long as the docs mention this with <note> or <warning> it's ok for > now. > OK, I'll add a warning explaining this. regards -- Tomas Vondra