linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: linux-mm@kvack.org
Cc: Miaohe Lin <linmiaohe@huawei.com>,
	Naoya Horiguchi <nao.horiguchi@gmail.com>,
	Jane Chu <jane.chu@oracle.com>
Subject: madvise_inject_error skips pages
Date: Tue, 16 Jul 2024 16:12:55 +0100	[thread overview]
Message-ID: <ZpaN9-PtftvgTd1s@casper.infradead.org> (raw)

I was going to send this patch:

+++ b/mm/madvise.c
@@ -1136,9 +1136,10 @@ static int madvise_inject_error(int behavior,
                /*
                 * When soft offlining hugepages, after migrating the page
                 * we dissolve it, therefore in the second loop "page" will
-                * no longer be a compound page.
+                * no longer be part of a large folio.
                 */
-               size = page_size(compound_head(page));
+               size = folio_size(page_folio(page));
+               start = start & ~(size - 1);

                if (behavior == MADV_SOFT_OFFLINE) {
                        pr_info("Soft offlining pfn %#lx at process virtual address %#lx\n",

because right now if you start in the middle of (e.g.) an order-4 folio
followed by an order-0 folio, you'll skip the order-0 folio immediately
following it.

But then I realised that we can come to this path in the middle of
a large file-backed folio that's mapped misaligned and has a COW page
in the middle, and the whole thing is just misguided.  So I gave up.
Anyone want to take a crack at fixing & testing this?


             reply	other threads:[~2024-07-16 15:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-16 15:12 Matthew Wilcox [this message]
2024-07-16 21:33 ` madvise_inject_error skips pages Jane Chu
2024-07-17  6:51   ` Miaohe Lin

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=ZpaN9-PtftvgTd1s@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=jane.chu@oracle.com \
    --cc=linmiaohe@huawei.com \
    --cc=linux-mm@kvack.org \
    --cc=nao.horiguchi@gmail.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;
as well as URLs for NNTP newsgroup(s).