All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Rapoport <rppt@kernel.org>
To: linux-mm@kvack.org
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Andy Lutomirski <luto@kernel.org>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	Ira Weiny <ira.weiny@intel.com>,
	Kees Cook <keescook@chromium.org>,
	Mike Rapoport <rppt@kernel.org>,
	Mike Rapoport <rppt@linux.ibm.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Rick Edgecombe <rick.p.edgecombe@intel.com>,
	Vlastimil Babka <vbabka@suse.cz>,
	linux-kernel@vger.kernel.org, x86@kernel.org
Subject: [RFC PATCH 2/3] mm/secretmem: use __GFP_UNMAPPED to allocate pages
Date: Thu, 27 Jan 2022 10:56:07 +0200	[thread overview]
Message-ID: <20220127085608.306306-3-rppt@kernel.org> (raw)
In-Reply-To: <20220127085608.306306-1-rppt@kernel.org>

From: Mike Rapoport <rppt@linux.ibm.com>

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@linux.ibm.com>
---
 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


  parent reply	other threads:[~2022-01-27  8:56 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-27  8:56 [RFC PATCH 0/3] Prototype for direct map awareness in page allocator Mike Rapoport
2022-01-27  8:56 ` [RFC PATCH 1/3] mm/page_alloc: introduce __GFP_UNMAPPED and MIGRATE_UNMAPPED Mike Rapoport
2022-01-27  8:56 ` Mike Rapoport [this message]
2022-01-27  8:56 ` [RFC PATCH 3/3] EXPERIMENTAL: x86/module: use __GFP_UNMAPPED in module_alloc Mike Rapoport
2022-04-26  8:54 ` [RFC PATCH 0/3] Prototype for direct map awareness in page allocator Hyeonggon Yoo
2022-04-26 15:21   ` Mike Rapoport
2022-04-30 13:44     ` Hyeonggon Yoo
2022-05-03  4:44       ` Mike Rapoport
2022-05-06 16:58         ` Hyeonggon Yoo
2022-05-11  7:50         ` Hyeonggon Yoo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220127085608.306306-3-rppt@kernel.org \
    --to=rppt@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=dave.hansen@linux.intel.com \
    --cc=ira.weiny@intel.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=luto@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rick.p.edgecombe@intel.com \
    --cc=rppt@linux.ibm.com \
    --cc=vbabka@suse.cz \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.