Message ID | 20220414101314.1250667-8-mawupeng1@huawei.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | introduce mirrored memory support for arm64 | expand |
On 14.04.22 12:13, Wupeng Ma wrote: > From: Ma Wupeng <mawupeng1@huawei.com> > > Previous 0x100000 is used to check the 4G limit in > find_zone_movable_pfns_for_nodes(). This is right in x86 because > the page size can only be 4K. But 16K and 64K are available in > arm64. So replace it with PHYS_PFN(SZ_4G). > > Signed-off-by: Ma Wupeng <mawupeng1@huawei.com> > --- > mm/page_alloc.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > index 6e5b4488a0c5..570d0ebf98df 100644 > --- a/mm/page_alloc.c > +++ b/mm/page_alloc.c > @@ -7870,7 +7870,7 @@ static void __init find_zone_movable_pfns_for_nodes(void) > > usable_startpfn = memblock_region_memory_base_pfn(r); > > - if (usable_startpfn < 0x100000) { > + if (usable_startpfn < PHYS_PFN(SZ_4G)) { > mem_below_4gb_not_mirrored = true; > continue; > } Reviewed-by: David Hildenbrand <david@redhat.com>
On 4/14/22 15:43, Wupeng Ma wrote: > From: Ma Wupeng <mawupeng1@huawei.com> > > Previous 0x100000 is used to check the 4G limit in > find_zone_movable_pfns_for_nodes(). This is right in x86 because > the page size can only be 4K. But 16K and 64K are available in > arm64. So replace it with PHYS_PFN(SZ_4G). > > Signed-off-by: Ma Wupeng <mawupeng1@huawei.com> > --- > mm/page_alloc.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > index 6e5b4488a0c5..570d0ebf98df 100644 > --- a/mm/page_alloc.c > +++ b/mm/page_alloc.c > @@ -7870,7 +7870,7 @@ static void __init find_zone_movable_pfns_for_nodes(void) > > usable_startpfn = memblock_region_memory_base_pfn(r); > > - if (usable_startpfn < 0x100000) { > + if (usable_startpfn < PHYS_PFN(SZ_4G)) { > mem_below_4gb_not_mirrored = true; > continue; > } Regardless PFN value should never be encoded directly. Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
On Tue, 19 Apr 2022 at 13:13, Anshuman Khandual <anshuman.khandual@arm.com> wrote: > > > > On 4/14/22 15:43, Wupeng Ma wrote: > > From: Ma Wupeng <mawupeng1@huawei.com> > > > > Previous 0x100000 is used to check the 4G limit in > > find_zone_movable_pfns_for_nodes(). This is right in x86 because > > the page size can only be 4K. But 16K and 64K are available in > > arm64. So replace it with PHYS_PFN(SZ_4G). > > > > Signed-off-by: Ma Wupeng <mawupeng1@huawei.com> > > --- > > mm/page_alloc.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > > index 6e5b4488a0c5..570d0ebf98df 100644 > > --- a/mm/page_alloc.c > > +++ b/mm/page_alloc.c > > @@ -7870,7 +7870,7 @@ static void __init find_zone_movable_pfns_for_nodes(void) > > > > usable_startpfn = memblock_region_memory_base_pfn(r); > > > > - if (usable_startpfn < 0x100000) { > > + if (usable_startpfn < PHYS_PFN(SZ_4G)) { > > mem_below_4gb_not_mirrored = true; > > continue; > > } > > Regardless PFN value should never be encoded directly. > > Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com> Acked-by: Ard Biesheuvel <ardb@kernel.org> Andrew, can you please take this one through the -mm tree? The rest of the series needs a bit more work, but is an obvious fix and there is no point in holding it up. Thanks, Ard.
On Tue, 19 Apr 2022 20:29:27 +0200 Ard Biesheuvel <ardb@kernel.org> wrote: > > > --- a/mm/page_alloc.c > > > +++ b/mm/page_alloc.c > > > @@ -7870,7 +7870,7 @@ static void __init find_zone_movable_pfns_for_nodes(void) > > > > > > usable_startpfn = memblock_region_memory_base_pfn(r); > > > > > > - if (usable_startpfn < 0x100000) { > > > + if (usable_startpfn < PHYS_PFN(SZ_4G)) { > > > mem_below_4gb_not_mirrored = true; > > > continue; > > > } > > > > Regardless PFN value should never be encoded directly. > > > > Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com> > > Acked-by: Ard Biesheuvel <ardb@kernel.org> > > Andrew, can you please take this one through the -mm tree? The rest of > the series needs a bit more work, but is an obvious fix and there is > no point in holding it up. Sure. I'm not seeing any description of the runtime effects of this shortcoming. I tentatively queued the fix for 5.18, without a cc:stable for backporting. But that might not be the best decision?
On Thu, 21 Apr 2022 at 00:27, Andrew Morton <akpm@linux-foundation.org> wrote: > > On Tue, 19 Apr 2022 20:29:27 +0200 Ard Biesheuvel <ardb@kernel.org> wrote: > > > > > --- a/mm/page_alloc.c > > > > +++ b/mm/page_alloc.c > > > > @@ -7870,7 +7870,7 @@ static void __init find_zone_movable_pfns_for_nodes(void) > > > > > > > > usable_startpfn = memblock_region_memory_base_pfn(r); > > > > > > > > - if (usable_startpfn < 0x100000) { > > > > + if (usable_startpfn < PHYS_PFN(SZ_4G)) { > > > > mem_below_4gb_not_mirrored = true; > > > > continue; > > > > } > > > > > > Regardless PFN value should never be encoded directly. > > > > > > Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com> > > > > Acked-by: Ard Biesheuvel <ardb@kernel.org> > > > > Andrew, can you please take this one through the -mm tree? The rest of > > the series needs a bit more work, but is an obvious fix and there is > > no point in holding it up. > > Sure. > > I'm not seeing any description of the runtime effects of this > shortcoming. I tentatively queued the fix for 5.18, without a > cc:stable for backporting. But that might not be the best decision? > As far as I can tell, mirrored memory is only used on x86 today, where pages are always 4k. However, the whole notion of memory below 4 GB being special is a x86-ism, and so this logic does not appear to extrapolate to other architectures anyway, and probably needs more work. So definitely not a backportable fix, but just an incremental improvement, so either 5.18 or 5.19 should be fine afaict (and no cc:stable)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 6e5b4488a0c5..570d0ebf98df 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -7870,7 +7870,7 @@ static void __init find_zone_movable_pfns_for_nodes(void) usable_startpfn = memblock_region_memory_base_pfn(r); - if (usable_startpfn < 0x100000) { + if (usable_startpfn < PHYS_PFN(SZ_4G)) { mem_below_4gb_not_mirrored = true; continue; }