diff options
author | Ralph Campbell <rcampbell@nvidia.com> | 2020-07-02 00:53:52 +0200 |
---|---|---|
committer | Jason Gunthorpe <jgg@nvidia.com> | 2020-07-10 21:24:28 +0200 |
commit | e478425bec930e9368c6efdc78d2e5d85eadc18e (patch) | |
tree | 59e9ec45cd3976e7ed79d083b17e379e39e62628 /lib/test_hmm.c | |
parent | mm/hmm: provide the page mapping order in hmm_range_fault() (diff) | |
download | linux-e478425bec930e9368c6efdc78d2e5d85eadc18e.tar.xz linux-e478425bec930e9368c6efdc78d2e5d85eadc18e.zip |
mm/hmm: add tests for hmm_pfn_to_map_order()
Add a sanity test for hmm_range_fault() returning the page mapping size
order.
Link: https://lore.kernel.org/r/20200701225352.9649-6-rcampbell@nvidia.com
Signed-off-by: Ralph Campbell <rcampbell@nvidia.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Diffstat (limited to 'lib/test_hmm.c')
-rw-r--r-- | lib/test_hmm.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/test_hmm.c b/lib/test_hmm.c index a2a82262b97b..9aa577afc269 100644 --- a/lib/test_hmm.c +++ b/lib/test_hmm.c @@ -766,6 +766,10 @@ static void dmirror_mkentry(struct dmirror *dmirror, struct hmm_range *range, *perm |= HMM_DMIRROR_PROT_WRITE; else *perm |= HMM_DMIRROR_PROT_READ; + if (hmm_pfn_to_map_order(entry) + PAGE_SHIFT == PMD_SHIFT) + *perm |= HMM_DMIRROR_PROT_PMD; + else if (hmm_pfn_to_map_order(entry) + PAGE_SHIFT == PUD_SHIFT) + *perm |= HMM_DMIRROR_PROT_PUD; } static bool dmirror_snapshot_invalidate(struct mmu_interval_notifier *mni, |