From: Mike Rapoport <rppt@kernel.org>
To: Hyeonggon Yoo <42.hyeyoo@gmail.com>
Cc: linux-mm@kvack.org, 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@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: Re: [RFC PATCH 0/3] Prototype for direct map awareness in page allocator
Date: Tue, 26 Apr 2022 18:21:57 +0300 [thread overview]
Message-ID: <YmgOFa3FUUpiANMq@kernel.org> (raw)
In-Reply-To: <YmezWeMZSRNRfXyG@hyeyoo>
Hello Hyeonggon,
On Tue, Apr 26, 2022 at 05:54:49PM +0900, Hyeonggon Yoo wrote:
> On Thu, Jan 27, 2022 at 10:56:05AM +0200, Mike Rapoport wrote:
> > From: Mike Rapoport <rppt@linux.ibm.com>
> >
> > Hi,
> >
> > This is a second attempt to make page allocator aware of the direct map
> > layout and allow grouping of the pages that must be mapped at PTE level in
> > the direct map.
> >
>
> Hello mike, It may be a silly question...
>
> Looking at implementation of set_memory*(), they only split
> PMD/PUD-sized entries. But why not _merge_ them when all entries
> have same permissions after changing permission of an entry?
>
> I think grouping __GFP_UNMAPPED allocations would help reducing
> direct map fragmentation, but IMHO merging split entries seems better
> to be done in those helpers than in page allocator.
Maybe, I didn't got as far as to try merging split entries in the direct
map. IIRC, Kirill sent a patch for collapsing huge pages in the direct map
some time ago, but there still was something that had to initiate the
collapse.
> For example:
> 1) set_memory_ro() splits 1 RW PMD entry into 511 RW PTE
> entries and 1 RO PTE entry.
>
> 2) before freeing the pages, we call set_memory_rw() and we have
> 512 RW PTE entries. Then we can merge it to 1 RW PMD entry.
For this we need to check permissions of all 512 pages to make sure we can
use a PMD entry to map them.
Not sure that doing the scan in each set_memory call won't cause an overall
slowdown.
> 3) after 2) we can do same thing about PMD-sized entries
> and merge them into 1 PUD entry if 512 PMD entries have
> same permissions.
>
> [...]
>
> > Mike Rapoport (3):
> > mm/page_alloc: introduce __GFP_UNMAPPED and MIGRATE_UNMAPPED
> > mm/secretmem: use __GFP_UNMAPPED to allocate pages
> > EXPERIMENTAL: x86/module: use __GFP_UNMAPPED in module_alloc
> >
> > arch/Kconfig | 7 ++
> > arch/x86/Kconfig | 1 +
> > arch/x86/kernel/module.c | 2 +-
> > include/linux/gfp.h | 13 +++-
> > include/linux/mmzone.h | 11 +++
> > include/trace/events/mmflags.h | 3 +-
> > mm/internal.h | 2 +-
> > mm/page_alloc.c | 129 ++++++++++++++++++++++++++++++++-
> > mm/secretmem.c | 8 +-
> > 9 files changed, 162 insertions(+), 14 deletions(-)
> >
> >
> > base-commit: e783362eb54cd99b2cac8b3a9aeac942e6f6ac07
> > --
> > 2.34.1
> >
>
> --
> Thanks,
> Hyeonggon
--
Sincerely yours,
Mike.
next prev parent reply other threads:[~2022-04-26 15:22 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-27 8:56 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 ` [RFC PATCH 2/3] mm/secretmem: use __GFP_UNMAPPED to allocate pages Mike Rapoport
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 [this message]
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=YmgOFa3FUUpiANMq@kernel.org \
--to=rppt@kernel.org \
--cc=42.hyeyoo@gmail.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox