Our use case is:

We maps both PMEM and hugetlb DRAM to process’s address space to provide large amount of memory to the application. Periodically, we clear the soft dirty bit by writing ‘4’ to the clear_refs. Then, we check the page’s soft dirty bit from pagemap and use this information to track write activity to memory. We migrate the data between DRAM and PMEM based the write activity for better performance.

 

Sent from Mail for Windows 10

 

From: Mike Kravetz
Sent: 2021
121 16:58
To: malate_wangshu@hotmail.com
Cc: Linux Memory Management List
Subject: [Bug 211287] New: Softdirty bit does not work with hugetlb

 

>> Start Bug Report <<
Bug ID: 211287
https://bugzilla.kernel.org/show_bug.cgi?id=211287
Summary: Softdirty bit does not work with hugetlb

When a memory region is mapped with huge pages, the softdirty bit is set only
right after the huge pages is mapped. After the memory mapping, if the
softdirty bit is cleared and the memory is written again, the softdirty bit is
not set when reading from the process's pagemap.
>> End Bug Report <<

I am not surprised with this reported bug.  The page fault code diverges
pretty quickly for hugetlb pages.  I have not looked closely at the details
of soft dirty, and do not immediately see where in the fault path for normal
pages it gets reset.  But, I only took a quick glance.

I can work on adding support for hugetlb.

Can you provide some details about your use case?
--
Mike Kravetz