RFR: JDK-8257588: Make os::_page_sizes a set [v2]

Thomas Schatzl tschatzl at openjdk.java.net
Thu Dec 3 12:28:55 UTC 2020


On Thu, 3 Dec 2020 12:13:53 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:

>> src/hotspot/share/runtime/os.cpp line 1904:
>> 
>>> 1902: size_t os::PagesizeSet::smallest() const {
>>> 1903:   assert(min_page_size() > 0, "Sanity");
>>> 1904:   return next_larger(min_page_size() / 2);
>> 
>> Why not just return `min_page_size()` here?
>> 
>> An assert may be added to check that they are the same though.
>
> Not sure what you mean.
> 
> PagesizeSet::smallest() returns the smallest page in the page size set, which may be any size, or 0 if empty. 
> 
> os::_page_sizes should always contain os::vm_page_size(), but that too is not the same as os::min_page_size(). os::min_page_size() is just a constant, equal or smaller than the smallest page size across all platforms.
> 
> The naming is confusing, and probably it could be just a static const instead of a function. But I don't want to touch that with this change. But there are probably a number of misuses of os::min_page_size() where the author actually meant os::vm_page_size().

Okay, apologies for falling into the mentioned trap.

-------------

PR: https://git.openjdk.java.net/jdk/pull/1522


More information about the hotspot-dev mailing list