There is no need to try to move_freepages_block for pages that is not
in buddy in function unset_migratetype_isolate, it can directly set
migrate type.
It will save a few cpu cycles for some situations such as cma and
hugetlb when allocating continue pages, in these situation function
alloc_contig_pages will be called.
alloc_contig_pages
__alloc_contig_migrate_range
isolate_freepages_range ==> pages has been remove from buddy
undo_isolate_page_range
unset_migratetype_isolate ==> can directly set migratetype
Fixes: 3c605096d315 ("mm/page_alloc: restrict max order of merging on isolated pageblock")
Signed-off-by: Chen Wandun <[email protected]>
---
mm/page_isolation.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/page_isolation.c b/mm/page_isolation.c
index f67c4c70f17f..6a0ddda6b3c5 100644
--- a/mm/page_isolation.c
+++ b/mm/page_isolation.c
@@ -115,7 +115,7 @@ static void unset_migratetype_isolate(struct page *page, unsigned migratetype)
* onlining - just onlined memory won't immediately be considered for
* allocation.
*/
- if (!isolated_page) {
+ if (!isolated_page && PageBuddy(page)) {
nr_pages = move_freepages_block(zone, page, migratetype, NULL);
__mod_zone_freepage_state(zone, nr_pages, migratetype);
}
--
2.18.0.huawei.25
On Wed, Dec 29, 2021 at 11:36:49AM +0800, Chen Wandun wrote:
> There is no need to try to move_freepages_block for pages that is not
> in buddy in function unset_migratetype_isolate, it can directly set
> migrate type.
The above could benefit from some rephrasing, someting along these lines
maybe?
"In unset_migratetype_isolate(), we can bypass the call to
move_freepages_block() for non-buddy pages"
>
> It will save a few cpu cycles for some situations such as cma and
> hugetlb when allocating continue pages, in these situation function
> alloc_contig_pages will be called.
>
> alloc_contig_pages
> __alloc_contig_migrate_range
> isolate_freepages_range ==> pages has been remove from buddy
> undo_isolate_page_range
> unset_migratetype_isolate ==> can directly set migratetype
>
> Fixes: 3c605096d315 ("mm/page_alloc: restrict max order of merging on isolated pageblock")
> Signed-off-by: Chen Wandun <[email protected]>
I am ok with the "fix", but I don't think this deserves a Fixes tag.
Sure, it can spare some cpu cycles, but besides that, there is no harm
in the actual code unless I missed something.
Others might feel stronger about that.
Reviewed-by: Oscar Salvador <[email protected]>
--
Oscar Salvador
SUSE Labs
Hi Chen,
Please see the bisection report below about a boot failure on
Meson arm64 platforms as well as QEMU when enabling 64K pages.
Reports aren't automatically sent to the public while we're
trialing new bisection features on kernelci.org but this one
looks valid.
Some more details can be found here:
QEMU: https://linux.kernelci.org/test/case/id/61dfcaa1dee57d03ffef673e/
ODROID-N2: https://linux.kernelci.org/test/case/id/61dfc93ac88e282ca8ef676b/
Here's a sample log showing some OOM errors before hitting a
kernel panic:
https://storage.kernelci.org/next/master/next-20220113/arm64/defconfig+config_arm64_64k_pages=y/gcc-10/lab-baylibre/baseline-meson-g12b-odroid-n2.html
<4>[ 24.666707] Out of memory and no killable processes...
<0>[ 24.672056] Kernel panic - not syncing: System is deadlocked on memory
Please let us know if you need any help to debug this issue or if
you have a fix to try.
Best wishes,
Guillaume
GitHub: https://github.com/kernelci/kernelci-project/issues/91
-------------------------------------------------------------------------------
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* This automated bisection report was sent to you on the basis *
* that you may be involved with the breaking commit it has *
* found. No manual investigation has been done to verify it, *
* and the root cause of the problem may be somewhere else. *
* *
* If you do send a fix, please include this trailer: *
* Reported-by: "kernelci.org bot" <[email protected]> *
* *
* Hope this helps! *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
next/master bisection: baseline.login on meson-g12b-odroid-n2
Summary:
Start: 27c9d5b3c24a Add linux-next specific files for 20220113
Plain log: https://storage.kernelci.org/next/master/next-20220113/arm64/defconfig+CONFIG_ARM64_64K_PAGES=y/gcc-10/lab-baylibre/baseline-meson-g12b-odroid-n2.txt
HTML log: https://storage.kernelci.org/next/master/next-20220113/arm64/defconfig+CONFIG_ARM64_64K_PAGES=y/gcc-10/lab-baylibre/baseline-meson-g12b-odroid-n2.html
Result: 075782149abf mm/page_isolation: unset migratetype directly for non Buddy page
Checks:
revert: PASS
verify: PASS
Parameters:
Tree: next
URL: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
Branch: master
Target: meson-g12b-odroid-n2
CPU arch: arm64
Lab: lab-baylibre
Compiler: gcc-10
Config: defconfig+CONFIG_ARM64_64K_PAGES=y
Test case: baseline.login
Breaking commit found:
-------------------------------------------------------------------------------
commit 075782149abff45ee22f27315eced44d02b96779
Author: Chen Wandun <[email protected]>
Date: Thu Dec 30 20:28:40 2021 +1100
mm/page_isolation: unset migratetype directly for non Buddy page
On 29/12/2021 03:36, Chen Wandun wrote:
> There is no need to try to move_freepages_block for pages that is not
> in buddy in function unset_migratetype_isolate, it can directly set
> migrate type.
>
> It will save a few cpu cycles for some situations such as cma and
> hugetlb when allocating continue pages, in these situation function
> alloc_contig_pages will be called.
>
> alloc_contig_pages
> __alloc_contig_migrate_range
> isolate_freepages_range ==> pages has been remove from buddy
> undo_isolate_page_range
> unset_migratetype_isolate ==> can directly set migratetype
>
> Fixes: 3c605096d315 ("mm/page_alloc: restrict max order of merging on isolated pageblock")
> Signed-off-by: Chen Wandun <[email protected]>
> ---
> mm/page_isolation.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/page_isolation.c b/mm/page_isolation.c
> index f67c4c70f17f..6a0ddda6b3c5 100644
> --- a/mm/page_isolation.c
> +++ b/mm/page_isolation.c
> @@ -115,7 +115,7 @@ static void unset_migratetype_isolate(struct page *page, unsigned migratetype)
> * onlining - just onlined memory won't immediately be considered for
> * allocation.
> */
> - if (!isolated_page) {
> + if (!isolated_page && PageBuddy(page)) {
> nr_pages = move_freepages_block(zone, page, migratetype, NULL);
> __mod_zone_freepage_state(zone, nr_pages, migratetype);
> }
Git bisection log:
-------------------------------------------------------------------------------
git bisect start
# good: [81ff0be4b9e3bcfee022d71cf89d72f7e2ed41ba] Merge tag 'spdx-5.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/spdx
git bisect good 81ff0be4b9e3bcfee022d71cf89d72f7e2ed41ba
# bad: [27c9d5b3c24af29de643533984f1ba3e650c7c78] Add linux-next specific files for 20220113
git bisect bad 27c9d5b3c24af29de643533984f1ba3e650c7c78
# good: [cf9e126911a1438ff36588f548a4137fe149d86c] Merge branch 'for-next' of git://git.kernel.dk/linux-block.git
git bisect good cf9e126911a1438ff36588f548a4137fe149d86c
# good: [05333947ad98119466c1bba228de30ab30aefa3f] Merge branch 'char-misc-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git
git bisect good 05333947ad98119466c1bba228de30ab30aefa3f
# good: [2f978ceb8fee3221c479d0caffcd296ff58f058d] Merge branch 'hyperv-next' of git://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux.git
git bisect good 2f978ceb8fee3221c479d0caffcd296ff58f058d
# bad: [d2bcbbe9073423477e7552a440e46f29a2ba0c55] panic: Remove oops_id.
git bisect bad d2bcbbe9073423477e7552a440e46f29a2ba0c55
# good: [fd4eb4516f5a2cc80d9ccff05900a3ff29bf4515] selftests/uffd: allow EINTR/EAGAIN
git bisect good fd4eb4516f5a2cc80d9ccff05900a3ff29bf4515
# bad: [98f4df2922a74f2369cf86b2df0375994766cdfe] mm/damon/reclaim: provide reclamation statistics
git bisect bad 98f4df2922a74f2369cf86b2df0375994766cdfe
# bad: [0212633f011d67bc1afe1b3611d9f61e4709c5b8] zsmalloc: introduce obj_allocated
git bisect bad 0212633f011d67bc1afe1b3611d9f61e4709c5b8
# bad: [34db36a7fab0af966a28cca95f2e08e89b33e700] mm/migrate: move node demotion code to near its user
git bisect bad 34db36a7fab0af966a28cca95f2e08e89b33e700
# bad: [a85e687fe7e5932b641d3abf99f66f3d57023850] mm/mempolicy: fix all kernel-doc warnings
git bisect bad a85e687fe7e5932b641d3abf99f66f3d57023850
# bad: [ed68b8bb2a653a1bedc8e1607a050e4200a75ebc] mm/mempolicy: add set_mempolicy_home_node syscall
git bisect bad ed68b8bb2a653a1bedc8e1607a050e4200a75ebc
# bad: [075782149abff45ee22f27315eced44d02b96779] mm/page_isolation: unset migratetype directly for non Buddy page
git bisect bad 075782149abff45ee22f27315eced44d02b96779
# good: [918650729924a97d11b38a38199c6ef96bcf9a73] vmscan: make drop_slab_node static
git bisect good 918650729924a97d11b38a38199c6ef96bcf9a73
# first bad commit: [075782149abff45ee22f27315eced44d02b96779] mm/page_isolation: unset migratetype directly for non Buddy page
-------------------------------------------------------------------------------
在 2022/1/15 4:50, Guillaume Tucker 写道:
> Hi Chen,
>
> Please see the bisection report below about a boot failure on
> Meson arm64 platforms as well as QEMU when enabling 64K pages.
>
> Reports aren't automatically sent to the public while we're
> trialing new bisection features on kernelci.org but this one
> looks valid.
>
> Some more details can be found here:
>
> QEMU: https://linux.kernelci.org/test/case/id/61dfcaa1dee57d03ffef673e/
> ODROID-N2: https://linux.kernelci.org/test/case/id/61dfc93ac88e282ca8ef676b/
>
> Here's a sample log showing some OOM errors before hitting a
> kernel panic:
>
> https://storage.kernelci.org/next/master/next-20220113/arm64/defconfig+config_arm64_64k_pages=y/gcc-10/lab-baylibre/baseline-meson-g12b-odroid-n2.html
>
> <4>[ 24.666707] Out of memory and no killable processes...
> <0>[ 24.672056] Kernel panic - not syncing: System is deadlocked on memory
>
> Please let us know if you need any help to debug this issue or if
> you have a fix to try.
>
> Best wishes,
> Guillaume
>
>
> GitHub: https://github.com/kernelci/kernelci-project/issues/91
>
> -------------------------------------------------------------------------------
>
> * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
> * This automated bisection report was sent to you on the basis *
> * that you may be involved with the breaking commit it has *
> * found. No manual investigation has been done to verify it, *
> * and the root cause of the problem may be somewhere else. *
> * *
> * If you do send a fix, please include this trailer: *
> * Reported-by: "kernelci.org bot" <[email protected]> *
> * *
> * Hope this helps! *
> * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
>
> next/master bisection: baseline.login on meson-g12b-odroid-n2
>
> Summary:
> Start: 27c9d5b3c24a Add linux-next specific files for 20220113
> Plain log: https://storage.kernelci.org/next/master/next-20220113/arm64/defconfig+CONFIG_ARM64_64K_PAGES=y/gcc-10/lab-baylibre/baseline-meson-g12b-odroid-n2.txt
> HTML log: https://storage.kernelci.org/next/master/next-20220113/arm64/defconfig+CONFIG_ARM64_64K_PAGES=y/gcc-10/lab-baylibre/baseline-meson-g12b-odroid-n2.html
> Result: 075782149abf mm/page_isolation: unset migratetype directly for non Buddy page
>
> Checks:
> revert: PASS
> verify: PASS
>
> Parameters:
> Tree: next
> URL: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
> Branch: master
> Target: meson-g12b-odroid-n2
> CPU arch: arm64
> Lab: lab-baylibre
> Compiler: gcc-10
> Config: defconfig+CONFIG_ARM64_64K_PAGES=y
> Test case: baseline.login
>
> Breaking commit found:
>
> -------------------------------------------------------------------------------
> commit 075782149abff45ee22f27315eced44d02b96779
> Author: Chen Wandun <[email protected]>
> Date: Thu Dec 30 20:28:40 2021 +1100
>
> mm/page_isolation: unset migratetype directly for non Buddy page
>
> On 29/12/2021 03:36, Chen Wandun wrote:
>> There is no need to try to move_freepages_block for pages that is not
>> in buddy in function unset_migratetype_isolate, it can directly set
>> migrate type.
>>
>> It will save a few cpu cycles for some situations such as cma and
>> hugetlb when allocating continue pages, in these situation function
>> alloc_contig_pages will be called.
>>
>> alloc_contig_pages
>> __alloc_contig_migrate_range
>> isolate_freepages_range ==> pages has been remove from buddy
>> undo_isolate_page_range
>> unset_migratetype_isolate ==> can directly set migratetype
>>
>> Fixes: 3c605096d315 ("mm/page_alloc: restrict max order of merging on isolated pageblock")
>> Signed-off-by: Chen Wandun <[email protected]>
>> ---
>> mm/page_isolation.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/mm/page_isolation.c b/mm/page_isolation.c
>> index f67c4c70f17f..6a0ddda6b3c5 100644
>> --- a/mm/page_isolation.c
>> +++ b/mm/page_isolation.c
>> @@ -115,7 +115,7 @@ static void unset_migratetype_isolate(struct page *page, unsigned migratetype)
>> * onlining - just onlined memory won't immediately be considered for
>> * allocation.
>> */
>> - if (!isolated_page) {
>> + if (!isolated_page && PageBuddy(page)) {
>> nr_pages = move_freepages_block(zone, page, migratetype, NULL);
>> __mod_zone_freepage_state(zone, nr_pages, migratetype);
>> }
This patch should be reverted, It has some difference compared with
original logic,and
will result memory that should in buddy disappear by mistake.
Thanks Guillaume
>
> Git bisection log:
>
> -------------------------------------------------------------------------------
> git bisect start
> # good: [81ff0be4b9e3bcfee022d71cf89d72f7e2ed41ba] Merge tag 'spdx-5.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/spdx
> git bisect good 81ff0be4b9e3bcfee022d71cf89d72f7e2ed41ba
> # bad: [27c9d5b3c24af29de643533984f1ba3e650c7c78] Add linux-next specific files for 20220113
> git bisect bad 27c9d5b3c24af29de643533984f1ba3e650c7c78
> # good: [cf9e126911a1438ff36588f548a4137fe149d86c] Merge branch 'for-next' of git://git.kernel.dk/linux-block.git
> git bisect good cf9e126911a1438ff36588f548a4137fe149d86c
> # good: [05333947ad98119466c1bba228de30ab30aefa3f] Merge branch 'char-misc-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git
> git bisect good 05333947ad98119466c1bba228de30ab30aefa3f
> # good: [2f978ceb8fee3221c479d0caffcd296ff58f058d] Merge branch 'hyperv-next' of git://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux.git
> git bisect good 2f978ceb8fee3221c479d0caffcd296ff58f058d
> # bad: [d2bcbbe9073423477e7552a440e46f29a2ba0c55] panic: Remove oops_id.
> git bisect bad d2bcbbe9073423477e7552a440e46f29a2ba0c55
> # good: [fd4eb4516f5a2cc80d9ccff05900a3ff29bf4515] selftests/uffd: allow EINTR/EAGAIN
> git bisect good fd4eb4516f5a2cc80d9ccff05900a3ff29bf4515
> # bad: [98f4df2922a74f2369cf86b2df0375994766cdfe] mm/damon/reclaim: provide reclamation statistics
> git bisect bad 98f4df2922a74f2369cf86b2df0375994766cdfe
> # bad: [0212633f011d67bc1afe1b3611d9f61e4709c5b8] zsmalloc: introduce obj_allocated
> git bisect bad 0212633f011d67bc1afe1b3611d9f61e4709c5b8
> # bad: [34db36a7fab0af966a28cca95f2e08e89b33e700] mm/migrate: move node demotion code to near its user
> git bisect bad 34db36a7fab0af966a28cca95f2e08e89b33e700
> # bad: [a85e687fe7e5932b641d3abf99f66f3d57023850] mm/mempolicy: fix all kernel-doc warnings
> git bisect bad a85e687fe7e5932b641d3abf99f66f3d57023850
> # bad: [ed68b8bb2a653a1bedc8e1607a050e4200a75ebc] mm/mempolicy: add set_mempolicy_home_node syscall
> git bisect bad ed68b8bb2a653a1bedc8e1607a050e4200a75ebc
> # bad: [075782149abff45ee22f27315eced44d02b96779] mm/page_isolation: unset migratetype directly for non Buddy page
> git bisect bad 075782149abff45ee22f27315eced44d02b96779
> # good: [918650729924a97d11b38a38199c6ef96bcf9a73] vmscan: make drop_slab_node static
> git bisect good 918650729924a97d11b38a38199c6ef96bcf9a73
> # first bad commit: [075782149abff45ee22f27315eced44d02b96779] mm/page_isolation: unset migratetype directly for non Buddy page
> -------------------------------------------------------------------------------
> .