On 5/10/19 9:16 AM, Larry Bassel wrote:
On 09 May 19 09:49, Matthew Wilcox wrote:
> On Thu, May 09, 2019 at 09:05:33AM -0700, Larry Bassel wrote:
>> This is based on (but somewhat different from) what hugetlbfs
>> does to share/unshare page tables.
> Wow, that worked out far more cleanly than I was expecting to see.
Yes, I was pleasantly surprised. As I've mentioned already, I
think this is at least partially due to the nature of DAX.
I have not looked in detail to make sure this is indeed all the places you
need to hook and special case for sharing/unsharing. Since this scheme is
somewhat like that used for hugetlb, I just wanted to point out some nasty
bugs related to hugetlb PMD sharing that were fixed last year.
5e41540c8a0f hugetlbfs: fix kernel BUG at fs/hugetlbfs/inode.c:444!
dff11abe280b hugetlb: take PMD sharing into account when flushing tlb/caches
017b1660df89 mm: migration: fix migration of huge PMD shared pages
The common issue in these is that when unmapping a page with a shared PMD
mapping you need to flush the entire shared range and not just the unmapped
page. The above changes were hugetlb specific. I do not know if any of
this applies in the case of DAX.