linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: lorenzo.stoakes@oracle.com
Cc: linux-mm@kvack.org
Subject: [bug report] mm/mremap: add MREMAP[_MUST]_RELOCATE_ANON support for large folios
Date: Wed, 25 Jun 2025 10:22:02 -0500	[thread overview]
Message-ID: <685c141c.050a0220.fc6e8.d33c@mx.google.com> (raw)

Hello Lorenzo Stoakes,

The patch a7fc0d8bd77d: "mm/mremap: add MREMAP[_MUST]_RELOCATE_ANON
support for large folios" from Jun 9, 2025, leads to the following
static checker warning:

mm/mremap.c:945 relocate_anon_pud() warn: sleeping in atomic context
mm/mremap.c:989 relocate_anon_pmd() warn: sleeping in atomic context

mm/mremap.c
    910 static bool relocate_anon_pud(struct pagetable_move_control *pmc,
    911 		pud_t *pudp, bool undo)
    912 {
    913 	spinlock_t *ptl;
    914 	pud_t pud;
    915 	struct folio *folio;
    916 	struct page *page;
    917 	bool ret;
    918 	unsigned long old_addr = pmc->old_addr;
    919 	unsigned long new_addr = pmc->new_addr;
    920 
    921 	VM_WARN_ON(old_addr & ~HPAGE_PUD_MASK);
    922 	VM_WARN_ON(new_addr & ~HPAGE_PUD_MASK);
    923 
    924 	ptl = pud_trans_huge_lock(pudp, pmc->old);
    925 	if (!ptl)
    926 		return false;
    927 
    928 	pud = pudp_get(pudp);
    929 	if (!pud_present(pud)) {
    930 		ret = true;
    931 		goto out;
    932 	}
    933 	if (!pud_leaf(pud)) {
    934 		ret = false;
    935 		goto out;
    936 	}
    937 
    938 	page = pud_page(pud);
    939 	if (!page) {
    940 		ret = true;
    941 		goto out;
    942 	}
    943 
    944 	folio = page_folio(page);
--> 945 	ret = relocate_large_folio(pmc, old_addr, new_addr, folio, undo);
                      ^^^^^^^^^^^^^^^^^^^^
This is a sleeping function because it takes the folio_lock().

    946 
    947 out:
    948 	spin_unlock(ptl);

but we're holding a spinlock so we're not allowed to sleep.

    949 	return ret;
    950 }

regards,
dan carpenter


             reply	other threads:[~2025-06-25 15:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-25 15:22 Dan Carpenter [this message]
2025-06-25 15:30 ` Lorenzo Stoakes

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=685c141c.050a0220.fc6e8.d33c@mx.google.com \
    --to=dan.carpenter@linaro.org \
    --cc=linux-mm@kvack.org \
    --cc=lorenzo.stoakes@oracle.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