[RFC PATCH 2/3] mm/secretmem: use __GFP_UNMAPPED to allocate pages
From: Mike Rapoport
Date: Thu Jan 27 2022 - 03:56:35 EST
From: Mike Rapoport <rppt@xxxxxxxxxxxxx>
Currently secertmem explicitly removes allocated pages from the direct map.
This fragments direct map because allocated pages may reside in different
pageblocks.
Use __GFP_UNMAPPED to utilize caching of unmapped pages done by the page
allocator.
Signed-off-by: Mike Rapoport <rppt@xxxxxxxxxxxxx>
---
mm/secretmem.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/mm/secretmem.c b/mm/secretmem.c
index 22b310adb53d..878ef004d7a7 100644
--- a/mm/secretmem.c
+++ b/mm/secretmem.c
@@ -63,16 +63,10 @@ static vm_fault_t secretmem_fault(struct vm_fault *vmf)
retry:
page = find_lock_page(mapping, offset);
if (!page) {
- page = alloc_page(gfp | __GFP_ZERO);
+ page = alloc_page(gfp | __GFP_ZERO | __GFP_UNMAPPED);
if (!page)
return VM_FAULT_OOM;
- err = set_direct_map_invalid_noflush(page);
- if (err) {
- put_page(page);
- return vmf_error(err);
- }
-
__SetPageUptodate(page);
err = add_to_page_cache_lru(page, mapping, offset, gfp);
if (unlikely(err)) {
--
2.34.1