public inbox for linux-mm@kvack.org
 help / color / mirror / Atom feed
From: Luiz Capitulino <luizcap@redhat.com>
To: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	david@redhat.com, yuzhao@google.com, pasha.tatashin@soleen.com
Cc: akpm@linux-foundation.org, hannes@cmpxchg.org,
	muchun.song@linux.dev, luizcap@redhat.com
Subject: [PATCH 0/4] mm: page_ext: Introduce new iteration API
Date: Tue, 18 Feb 2025 21:17:46 -0500	[thread overview]
Message-ID: <cover.1739931468.git.luizcap@redhat.com> (raw)

Hi,

  [ Thanks to David Hildenbrand for identifying the root cause of this
    issue and proving guidance on how to fix it. The new API idea, bugs
    and misconceptions are all mine though ]

Currently, trying to reserve 1G pages with page_owner=on and sparsemem
causes a crash. The reproducer is very simple:

 1. Build the kernel with CONFIG_SPARSEMEM=y and the table extensions
 2. Pass 'default_hugepagesz=1 page_owner=on' in the kernel command-line
 3. Reserve one 1G page at run-time, this should crash (see patch 1 for
    backtrace) 

 [ A crash with page_table_check is also possible, but harder to trigger ]

Apparently, starting with commit cf54f310d0d3 ("mm/hugetlb: use __GFP_COMP
for gigantic folios") we now pass the full allocation order to page
extension clients and the page extension implementation assumes that all
PFNs of an allocation range will be stored in the same memory section (which
is not true for 1G pages).

To fix this, this series introduces a new iteration API for page extension
objects. The API checks if the next page extension object can be retrieved
from the current section or if it needs to look up for it in another
section.

All details in patch 1. Also, this series is against Linus tree commit
2408a807bfc3f738850ef5ad5e3fd59d66168996 .

RFC -> v1
=========

- Revamped the API by introducing for_each_page_ext macros
- Implemented various suggestions from David Hildenbrand, including page_ext
  lookup optimization
- Fixed changelogs

Luiz Capitulino (4):
  mm: page_ext: add an iteration API for page extensions
  mm: page_table_check: use new iteration API
  mm: page_owner: use new iteration API
  mm: page_ext: make page_ext_next() private to page_ext

 include/linux/page_ext.h | 67 +++++++++++++++++++++++++++++++++++++---
 mm/page_ext.c            | 48 ++++++++++++++++++++++++++++
 mm/page_owner.c          | 61 +++++++++++++++++-------------------
 mm/page_table_check.c    | 39 +++++++----------------
 4 files changed, 152 insertions(+), 63 deletions(-)

-- 
2.48.1



             reply	other threads:[~2025-02-19  2:18 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-19  2:17 Luiz Capitulino [this message]
2025-02-19  2:17 ` [PATCH 1/4] mm: page_ext: add an iteration API for page extensions Luiz Capitulino
2025-02-20 10:59   ` David Hildenbrand
2025-02-20 20:36     ` Luiz Capitulino
2025-02-20 20:45       ` David Hildenbrand
2025-02-20 20:47         ` David Hildenbrand
2025-02-20 21:12         ` Luiz Capitulino
2025-02-19  2:17 ` [PATCH 2/4] mm: page_table_check: use new iteration API Luiz Capitulino
2025-02-20 11:05   ` David Hildenbrand
2025-02-20 20:37     ` Luiz Capitulino
2025-02-19  2:17 ` [PATCH 3/4] mm: page_owner: " Luiz Capitulino
2025-02-19  2:17 ` [PATCH 4/4] mm: page_ext: make page_ext_next() private to page_ext Luiz Capitulino
2025-02-19 23:52 ` [PATCH 0/4] mm: page_ext: Introduce new iteration API Andrew Morton
2025-02-20 10:49   ` David Hildenbrand
2025-02-20 20:23     ` Luiz Capitulino

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=cover.1739931468.git.luizcap@redhat.com \
    --to=luizcap@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=muchun.song@linux.dev \
    --cc=pasha.tatashin@soleen.com \
    --cc=yuzhao@google.com \
    /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