The condition for when a special mapping should use only large pages or a mix of large and normal is confusing.
The current statement is:
```
if (is_aligned(bytes, os::large_page_size()) && alignment <= os::large_page_size()) {
return reserve_memory_special_huge_tlbfs_only(bytes, req_addr, exec);
} else {
return reserve_memory_special_huge_tlbfs_mixed(bytes, alignment, req_addr, exec);
}
```
The confusing part here is the alignment check, because if the size is aligned with the page size we know the mapping don't have to use a mix of large and small pages. The reason the alignment check is there is because there are cases where the alignment is large than the page size and currently only the reserve_memory_special_huge_tlbfs_mixed()-call honour the alignment request.
To solve this we should refactor the function to handle all uses-cases without the only/mixed helpers.
The current statement is:
```
if (is_aligned(bytes, os::large_page_size()) && alignment <= os::large_page_size()) {
return reserve_memory_special_huge_tlbfs_only(bytes, req_addr, exec);
} else {
return reserve_memory_special_huge_tlbfs_mixed(bytes, alignment, req_addr, exec);
}
```
The confusing part here is the alignment check, because if the size is aligned with the page size we know the mapping don't have to use a mix of large and small pages. The reason the alignment check is there is because there are cases where the alignment is large than the page size and currently only the reserve_memory_special_huge_tlbfs_mixed()-call honour the alignment request.
To solve this we should refactor the function to handle all uses-cases without the only/mixed helpers.