linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: linux-mm@kvack.org, David Hildenbrand <david@redhat.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Mike Kravetz <mike.kravetz@oracle.com>,
	Muchun Song <muchun.song@linux.dev>
Subject: [PATCH v1 0/5] mm/rmap: separate hugetlb rmap handling
Date: Tue, 28 Nov 2023 15:52:00 +0100	[thread overview]
Message-ID: <20231128145205.215026-1-david@redhat.com> (raw)

Let's just cleanly separate hugetlb rmap handling from "ordinary" rmap
handling, like we already do when adding anon hugetlb folios. We have
hugetlb special-casing/checks in the callers in all cases either way
already in place: it doesn't make too much sense to call generic-looking
functions that end up doing hugetlb specific things from hugetlb
special-cases.

This now also means that we won't run into "folio_test_pmd_mappable()"
cases for hugetlb, which doesn't make too much sense with gigantic hugetlb
folios that are in fact currently only PUD-mappable. Or having a
folio_add_file_rmap() function that looks like it clould be used by hugetlb
code, but really can't.

This is a stanalone cleanup, but it gets more relevant when adding more
rmap batching (we cannot map parts of a hugetlb folio) or changing the way
we handle partially-mappable folios as in [1], whereby we'd have to add
more hugetlb special casing to keep hugetlb working as is.

If ever something about hugetlb changes that makes them actually
partially-mappable folios, we can look into cleanly merging all code
paths, not just some.

[1] https://lkml.kernel.org/r/20231124132626.235350-1-david@redhat.com

Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Mike Kravetz <mike.kravetz@oracle.com>
Cc: Muchun Song <muchun.song@linux.dev>

David Hildenbrand (5):
  mm/rmap: rename hugepage_add* to hugetlb_add*
  mm/rmap: introduce and use hugetlb_remove_rmap()
  mm/rmap: introduce and use hugetlb_add_file_rmap()
  mm/rmap: introduce and use hugetlb_try_dup_anon_rmap()
  mm/rmap: add hugetlb sanity checks

 include/linux/mm.h   | 12 +++++++++---
 include/linux/rmap.h | 37 +++++++++++++++++++++++++++++++++++--
 mm/hugetlb.c         | 21 ++++++++++-----------
 mm/migrate.c         |  6 +++---
 mm/rmap.c            | 31 ++++++++++++++++++-------------
 5 files changed, 75 insertions(+), 32 deletions(-)


base-commit: b85ea95d086471afb4ad062012a4d73cd328fa86
-- 
2.41.0



             reply	other threads:[~2023-11-28 14:52 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-28 14:52 David Hildenbrand [this message]
2023-11-28 14:52 ` [PATCH v1 1/5] mm/rmap: rename hugepage_add* to hugetlb_add* David Hildenbrand
2023-11-29  8:42   ` Muchun Song
2023-11-28 14:52 ` [PATCH v1 2/5] mm/rmap: introduce and use hugetlb_remove_rmap() David Hildenbrand
2023-11-28 16:08   ` Peter Xu
     [not found]     ` <f1b52042-646d-4679-b375-7550973701f5@redhat.com>
2023-11-28 17:13       ` Peter Xu
2023-11-28 17:42         ` David Hildenbrand
2023-11-28 19:48           ` Peter Xu
2023-11-28 14:52 ` [PATCH v1 3/5] mm/rmap: introduce and use hugetlb_add_file_rmap() David Hildenbrand
2023-11-28 14:52 ` [PATCH v1 4/5] mm/rmap: introduce and use hugetlb_try_dup_anon_rmap() David Hildenbrand
2023-11-28 14:52 ` [PATCH v1 5/5] mm/rmap: add hugetlb sanity checks David Hildenbrand

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=20231128145205.215026-1-david@redhat.com \
    --to=david@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mike.kravetz@oracle.com \
    --cc=muchun.song@linux.dev \
    /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