mirror of
https://github.com/php/php-src.git
synced 2025-08-21 01:45:16 +02:00
opcache huge pages: Little fix for FreeBSD
Calculating the vm entries size beforehand, as we could possibly miss few entries. Closes GH-4344.
This commit is contained in:
parent
237f07ea9d
commit
994a01ea43
1 changed files with 1 additions and 1 deletions
|
@ -2746,9 +2746,9 @@ static void accel_move_code_to_huge_pages(void)
|
||||||
int mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_VMMAP, getpid()};
|
int mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_VMMAP, getpid()};
|
||||||
long unsigned int huge_page_size = 2 * 1024 * 1024;
|
long unsigned int huge_page_size = 2 * 1024 * 1024;
|
||||||
if(sysctl(mib, 4, NULL, &s, NULL, 0) == 0) {
|
if(sysctl(mib, 4, NULL, &s, NULL, 0) == 0) {
|
||||||
|
s = s * 4 / 3;
|
||||||
void *addr = mmap(NULL, s * sizeof (struct kinfo_vmentry), PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0);
|
void *addr = mmap(NULL, s * sizeof (struct kinfo_vmentry), PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0);
|
||||||
if (addr != MAP_FAILED) {
|
if (addr != MAP_FAILED) {
|
||||||
s = s * 4 / 3;
|
|
||||||
if (sysctl(mib, 4, addr, &s, NULL, 0) == 0) {
|
if (sysctl(mib, 4, addr, &s, NULL, 0) == 0) {
|
||||||
uintptr_t start = (uintptr_t)addr;
|
uintptr_t start = (uintptr_t)addr;
|
||||||
uintptr_t end = start + s;
|
uintptr_t end = start + s;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue