linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* madvise_inject_error skips pages
@ 2024-07-16 15:12 Matthew Wilcox
  2024-07-16 21:33 ` Jane Chu
  0 siblings, 1 reply; 3+ messages in thread
From: Matthew Wilcox @ 2024-07-16 15:12 UTC (permalink / raw)
  To: linux-mm; +Cc: Miaohe Lin, Naoya Horiguchi, Jane Chu

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?


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-07-17  6:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-16 15:12 madvise_inject_error skips pages Matthew Wilcox
2024-07-16 21:33 ` Jane Chu
2024-07-17  6:51   ` Miaohe Lin

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).