shmget: Use transparent huge pages when page size isn't specified
Refs: #1241 Change-Id: Ia111bfeb67d224ad1ab77e5193eac7b7d14a6577
This commit is contained in:
@@ -5196,9 +5196,25 @@ int do_shmget(const key_t key, const size_t size, const int shmflg)
|
|||||||
return -ENOSPC;
|
return -ENOSPC;
|
||||||
}
|
}
|
||||||
|
|
||||||
pgshift = PAGE_SHIFT;
|
|
||||||
if (shmflg & SHM_HUGETLB) {
|
if (shmflg & SHM_HUGETLB) {
|
||||||
pgshift = (shmflg >> SHM_HUGE_SHIFT) & 0x3F;
|
pgshift = (shmflg >> SHM_HUGE_SHIFT) & 0x3F;
|
||||||
|
} else {
|
||||||
|
size_t pgsize;
|
||||||
|
int p2align;
|
||||||
|
|
||||||
|
if (size > PAGE_SIZE) {
|
||||||
|
error = arch_get_smaller_page_size(NULL, size + 1,
|
||||||
|
&pgsize, &p2align);
|
||||||
|
if (error) {
|
||||||
|
ekprintf("%s: WARNING: arch_get_smaller_page_size failed. size: %ld, error: %d\n",
|
||||||
|
__func__, size, error);
|
||||||
|
pgshift = PAGE_SHIFT;
|
||||||
|
} else {
|
||||||
|
pgshift = p2align + PAGE_SHIFT;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
pgshift = PAGE_SHIFT;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(&ads, 0, sizeof(ads));
|
memset(&ads, 0, sizeof(ads));
|
||||||
|
|||||||
Reference in New Issue
Block a user