From: "liuq131@chinatelecom.cn" <liuq131@chinatelecom.cn>
To: "baolin.wang@linux.alibaba.com" <baolin.wang@linux.alibaba.com>
Cc: "akpm@linux-foundation.org" <akpm@linux-foundation.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
"liuq131@chinatelecom.cn" <liuq131@chinatelecom.cn>
Subject: Re: [PATCH] mm/compaction: fix the total_isolated in strict mode
Date: Tue, 12 Nov 2024 07:51:53 +0000 [thread overview]
Message-ID: <TYSPR01MB5702BA8F9AE17746F198F077F0592@TYSPR01MB5702.apcprd01.prod.exchangelabs.com> (raw)
We assume that the block we are currently processing is distributed as follows:
0 1 2 511
--------------------------------------------------
| | | |
--------------------------------------------------
Index 0 and 1 are both pages with an order of 0.
Index 2 has a bogus order (let's assume the order is 9).
When the for loop reaches index 2, it will enter the following code:
/*
* For compound pages such as THP and hugetlbfs, we can save
* potentially a lot of iterations if we skip them at once.
* The check is racy, but we can consider only valid values
* and the only danger is skipping too much.
*/
if (PageCompound(page)) {
const unsigned int order = compound_order(page);
if (blockpfn + (1UL << order) <= end_pfn) {
blockpfn += (1UL << order) - 1;
page += (1UL << order) - 1;
nr_scanned += (1UL << order) - 1;
}
goto isolate_fail;
}
After exiting the for loop:
blockpfn =basepfn+ 2+2^9 = basepfn+514;
endpfn = basepfn +512;
total_isolated = 2;
nr_scanned = 514;
/*
* Be careful to not go outside of the pageblock.
*/
if (unlikely(blockpfn > end_pfn))
blockpfn = end_pfn;
So this can happen
/*
* If strict isolation is requested by CMA then check that all the
* pages requested were isolated. If there were any failures, 0 is
* returned and CMA will fail.
*/
if (strict && blockpfn < end_pfn)
total_isolated = 0;
If processed according to the old code, it will not enter the if statement to reset
total_isolated, but the correct handling is to reset total_isolated to 0.
next reply other threads:[~2024-11-12 8:01 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-12 7:51 liuq131 [this message]
-- strict thread matches above, loose matches on Subject: below --
2024-11-14 3:39 liuq131
2024-11-14 2:29 liuq131
2024-11-02 20:16 Qiang Liu
2024-11-12 0:22 ` Andrew Morton
2024-11-12 1:24 ` Baolin Wang
[not found] ` <2024111210165296529720@chinatelecom.cn>
2024-11-12 9:47 ` Baolin Wang
2024-11-14 1:54 ` Qiang Liu
2024-11-14 1:55 ` Qiang Liu
2024-11-14 2:10 ` Qiang Liu
2024-11-14 2:58 ` Baolin Wang
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=TYSPR01MB5702BA8F9AE17746F198F077F0592@TYSPR01MB5702.apcprd01.prod.exchangelabs.com \
--to=liuq131@chinatelecom.cn \
--cc=akpm@linux-foundation.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
/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
all inboxes | Powered by JetHome®