Page MenuHomeFreeBSD

Have posixshm_test ask the kernel for the page size
ClosedPublic

Authored by andrew on Apr 19 2022, 5:10 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Dec 11, 12:36 AM
Unknown Object (File)
Wed, Nov 20, 8:19 PM
Unknown Object (File)
Nov 8 2024, 2:57 AM
Unknown Object (File)
Nov 5 2024, 1:40 PM
Unknown Object (File)
Oct 19 2024, 9:33 PM
Unknown Object (File)
Oct 5 2024, 1:42 PM
Unknown Object (File)
Oct 4 2024, 1:30 PM
Unknown Object (File)
Oct 2 2024, 6:33 PM
Subscribers

Details

Summary

It may be dynamic so we can't rely on PAGE_SIZE being present or
correct.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

tests/sys/posixshm/posixshm_test.c
1127

This one doesn't look correct for non-4k pages.

tests/sys/posixshm/posixshm_test.c
1207–1208

Why not use ps[0] here as is done elsewhere?

tests/sys/posixshm/posixshm_test.c
1127

Yeah, looks like it's supposed to be 1 << PAGE_SHIFT.

  • Remove a call to getpagesize when we already have it's result in the ps array
  • Use page_size as the offset in the Aligned fspacectl(fd, SPACECTL_DEALLOC, ...) to OFF_MAX test
This revision is now accepted and ready to land.Apr 19 2022, 5:28 PM

One possible nit

tests/sys/posixshm/posixshm_test.c
1193

This weakens the test. Shouldn't it be == page_size and make page_size a global?

tests/sys/posixshm/posixshm_test.c
1193

It's more of a sanity check than a test.

BTW, should PAGE_SIZE be the least guaranteed page size? In other words, should some test ensure _Static_assert(PAGE_SIZE <= ps[0]). Also perhaps something about ps[0] being multiple of PAGE_SIZE worth to be guaranteed?

PAGE_SIZE is passed into mmap so would need to be the maximum value. I've created D34980 to add a test that the values we get from getpagesize and getpagesizes are what we expect.