Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit b33bd81

Browse files
anarazelCommitfest Bot
authored and
Commitfest Bot
committed
WIP: Use MAP_POPULATE
For benchmarking it's quite annoying that the first time a memory is touched has completely different perf characteristics than subsequent accesses. Using MAP_POPULATE reduces that substantially.
1 parent e1a943b commit b33bd81

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/backend/port/sysv_shmem.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,7 @@ CreateAnonymousSegment(Size *size)
620620
allocsize += hugepagesize - (allocsize % hugepagesize);
621621

622622
ptr = mmap(NULL, allocsize, PROT_READ | PROT_WRITE,
623-
PG_MMAP_FLAGS | mmap_flags, -1, 0);
623+
PG_MMAP_FLAGS | MAP_POPULATE | mmap_flags, -1, 0);
624624
mmap_errno = errno;
625625
if (huge_pages == HUGE_PAGES_TRY && ptr == MAP_FAILED)
626626
elog(DEBUG1, "mmap(%zu) with MAP_HUGETLB failed, huge pages disabled: %m",

0 commit comments

Comments
 (0)