DEVICE_COHERENT pages introduce a subtle distinction in the way "normal" pages can be used by various callers throughout the kernel. They behave like normal pages for purposes of mapping in CPU page tables, and for COW. But they do not support LRU lists, NUMA migration or THP. Therefore we split vm_normal_page into two functions vm_normal_any_page and vm_normal_lru_page. The latter will only return pages that can be put on an LRU list and that support NUMA migration, KSM and THP. HMM tests were added to selftest to excercise these changes with device coherent pages. New test called hmm_cow_in_device, will test pages marked as COW, allocated in device zone. Also, more configurations were added into hmm_gup_test to test basic get user pages and get user pages fast paths in device zone pages. Alex Sierra (3): mm: split vm_normal_pages for LRU and non-LRU handling tools: add more gup configs to hmm_gup selftests tools: add selftests to hmm for COW in device memory fs/proc/task_mmu.c | 12 +-- include/linux/mm.h | 11 +- mm/gup.c | 10 +- mm/hmm.c | 2 +- mm/huge_memory.c | 2 +- mm/khugepaged.c | 8 +- mm/ksm.c | 4 +- mm/madvise.c | 4 +- mm/memcontrol.c | 2 +- mm/memory.c | 38 ++++--- mm/mempolicy.c | 4 +- mm/migrate.c | 2 +- mm/migrate_device.c | 2 +- mm/mlock.c | 6 +- mm/mprotect.c | 2 +- tools/testing/selftests/vm/hmm-tests.c | 139 +++++++++++++++++++++---- 16 files changed, 185 insertions(+), 63 deletions(-) -- 2.32.0