Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jiri Bohac <jbohac@suse.cz>
To: "David Hildenbrand (Arm)" <david@kernel.org>
Cc: Sang-Heon Jeon <ekffu200098@gmail.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	"Liam R. Howlett" <liam@infradead.org>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	Michal Hocko <mhocko@suse.com>, Mike Rapoport <rppt@kernel.org>,
	Vlastimil Babka <vbabka@kernel.org>,
	Qi Zheng <zhengqi.arch@bytedance.com>,
	Usama Arif <usama.arif@linux.dev>,
	Muchun Song <muchun.song@linux.dev>,
	Oscar Salvador <osalvador@suse.de>,
	Frank van der Linden <fvdl@google.com>,
	Kiryl Shutsemau <kas@kernel.org>,
	Baoquan He <baoquan.he@linux.dev>,
	Pasha Tatashin <pasha.tatashin@soleen.com>,
	Pratyush Yadav <pratyush@kernel.org>,
	kexec@lists.infradead.org
Subject: Re: [PATCH] mm/cma: reject long-term pins of HugeTLB folios overlapping crashkernel CMA
Date: Fri, 27 Nov 2026 18:43:40 +0100	[thread overview]
Message-ID: <awnBTG3budAQqfSq@dwarf.suse.cz> (raw)
In-Reply-To: <f79014e3-3c81-4b2b-87f6-df0c2d946357@kernel.org>

On Wed, Nov 25, 2026 at 11:43:40PM +0100, David Hildenbrand (Arm) wrote:
> On 11/25/26 16:51, Sang-Heon Jeon wrote:
> > crashkernel=size,cma uses existing hugetlb_cma memory, so
> > crashk_cma_ranges[] may contain HugeTLB folios. HugeTLB folios allocated
> > from hugetlb_cma can be long-term pinned without being migrated.
> > 
> > After a crash, the crash kernel uses the memory in crashk_cma_ranges[],
> > but a device can still write to a long-term pinned folio.
> > 
> > So reject long-term pins of HugeTLB folios overlapping
> > crashk_cma_ranges[].
> > 
> > Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>
> > ---
> > The above scenario is only possible with the two patches below applied.
> > Currently only linux-next, which is targeting v7.5, has both of them.
> > 
> >   "mm/hugetlb: allow crashkernel to reuse hugetlb CMA memory" (kexec-next)
> 
> I think that's a real problem with this thing.
> 
> The solution is not to disallow long-term pinning. :/

This patch does not disallow or break the long-term pinning. It just makes
sure the pages are migrated away from the CMA before get_user_pages pins them.

As has always been the case prior to 
  "mm: gup: allow long-term pins of CMA-allocated HugeTLB folios"
(in mm-unstable), which introduces an exception for hugetlb CMA
and allows the pinning without migration.

And this exception breaks the assumption that CMA does not
contain long-term pinned pages. The short delay prior to kexec
when CMA is used for crashkernel is there to wait for pending DMA
into short-term pinned pages, not long-term pinned ones.

Including 
  "mm: gup: allow long-term pins of CMA-allocated HugeTLB folios"
without this followup breaks this assumption, which we discussed
during the merge of the crashkernel CMA patchset.


-- 
Jiri Bohac <jbohac@suse.cz>
SUSE Labs, Prague, Czechia



      parent reply	other threads:[~2026-11-27 17:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-25 15:51 [PATCH] mm/cma: reject long-term pins of HugeTLB folios overlapping crashkernel CMA Sang-Heon Jeon
2026-11-25 21:49 ` Usama Arif
2026-11-26 13:07   ` David Hildenbrand (Arm)
2026-11-26 15:16     ` Sang-Heon Jeon
2026-11-25 22:43 ` David Hildenbrand (Arm)
2026-11-26  8:21   ` Michal Hocko
2026-11-27 17:43   ` Jiri Bohac [this message]

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=awnBTG3budAQqfSq@dwarf.suse.cz \
    --to=jbohac@suse.cz \
    --cc=akpm@linux-foundation.org \
    --cc=baoquan.he@linux.dev \
    --cc=david@kernel.org \
    --cc=ekffu200098@gmail.com \
    --cc=fvdl@google.com \
    --cc=kas@kernel.org \
    --cc=kexec@lists.infradead.org \
    --cc=liam@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=muchun.song@linux.dev \
    --cc=osalvador@suse.de \
    --cc=pasha.tatashin@soleen.com \
    --cc=pratyush@kernel.org \
    --cc=rppt@kernel.org \
    --cc=usama.arif@linux.dev \
    --cc=vbabka@kernel.org \
    --cc=zhengqi.arch@bytedance.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