LLNL / umap

User-space Page Management
GNU Lesser General Public License v2.1
104 stars 22 forks source link

Different page sizes for different regions #116

Closed Bouncner closed 2 years ago

Bouncner commented 2 years ago

When I understand the 2019 paper correctly (Peng et al., UMap: Enabling application-driven optimizations for page management), umap supports different page sizes.

However, to me, it looks like the region manager (which is a singleton) has a single member m_umap_page_size which is used for all regions. Can you help me understanding how to use different page sizes?

IBPeng commented 2 years ago

All regions use the same page size. The page size is configurable through runtime environment variable UMAP_PAGESIZE

Bouncner commented 2 years ago

Just to be sure that I get this right. Is this different to what is stated in the paper? Or is there another unit above "regions" that allow variable page sizes?

image
mayagokhale commented 2 years ago

Thanks for following up. The intent of that statement was to contrast that UMap allows the application to specify a custom page size as a multiple of 4K pages whereas system mmap supports fixed size pages e.g. 4K, 2M, 1G. As you point it, the wording suggests that UMap allows the application to choose different page sizes for different userfaultfd regions. That is not what is implemented in the code. As clarified above, the user may set an environment variable indicating the UMap page size (e.g. 16K or 64K) that that page size is used for all mapped regions.

The better wording would be that UMap supports an arbitrary page size selectable at runtime which may be uniquely selected for each application and for each application invocation.

We do have a private fork that implements different page sizes for different regions in a single application. That version was tested with our application set and found not to improve performance and therefore was not merged back into our main branch.

Bouncner commented 2 years ago

Reading papers like this one sounds like having the chance to play around with different page sizes might be really advantageous. Is it possible to test this private branch?

mayagokhale commented 2 years ago

It is a feature in progress of being implemented. What is your use case?

Bouncner commented 2 years ago

We are using Umap within an in-memory database system. Depending on the workload, smaller or larger page sizes can be beneficial.

We don't have a paper yet to show, but we have seen interesting effects which we would like to further study when possible.