mm: memory: use nth_page() in clear/copy_subpage()
Subsystems (2)
PATCH 1/1 mm: memory: use nth_page() in clear/copy_subpage()
The clear and copy of huge gigantic page has converted to use nth_page() to handle the possible discontinuous struct page(SPARSEMEM without VMEMMAP), but not change for the non-gigantic part, fix it too.
--- mm/memory.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
mm/memory.c +5 -4
@@ -6039,7 +6039,7 @@ static int clear_subpage(unsigned long addr, int idx, void *arg) {struct page *page = arg; -clear_user_highpage (page + idx, addr); +clear_user_highpage (nth_page (page, idx), addr);return 0 ; }
@@ -6089,10 +6089,11 @@ struct copy_subpage_arg {static int copy_subpage (unsigned long addr,int idx,void *arg) {struct copy_subpage_arg *copy_arg = arg; +struct page *dst =nth_page (copy_arg->dst, idx); +struct page *src =nth_page (copy_arg->src, idx); -if (copy_mc_user_highpage (copy_arg->dst + idx, copy_arg->src + idx, - addr, copy_arg->vma)) { -memory_failure_queue (page_to_pfn (copy_arg->src + idx),0 ); +if (copy_mc_user_highpage (dst, src, addr, copy_arg->vma)) { +memory_failure_queue (page_to_pfn (src),0 );return -EHWPOISON ; }return 0 ;
Signature · 1 line
2.41.0
Quoted 3 lines · Kefeng Wang
The clear and copy of huge gigantic page has converted to use
nth_page()to handle the possible discontinuous struct page(SPARSEMEM without VMEMMAP), but not change for the non-gigantic part, fix it too.
Can there be discontiguities within a non-gigantic huge page? My impression was that you can't have a discontiguity at such a small boundary.
Quoted 8 lines · Matthew Wilcox
Quoted 3 lines · Kefeng Wang
The clear and copy of huge gigantic page has converted to use
nth_page()to handle the possible discontinuous struct page(SPARSEMEM without VMEMMAP), but not change for the non-gigantic part, fix it too.Can there be discontiguities within a non-gigantic huge page? My impression was that you can't have a discontiguity at such a small boundary.
No, we can't. MAX_ORDER allocations from the buddy always completely fit into a memory section.
Signature · 3 lines
Cheers, David / dhildenb
Quoted 11 lines · David Hildenbrand
Quoted 8 lines · Matthew Wilcox
Quoted 3 lines · Kefeng Wang
The clear and copy of huge gigantic page has converted to use
nth_page()to handle the possible discontinuous struct page(SPARSEMEM without VMEMMAP), but not change for the non-gigantic part, fix it too.Can there be discontiguities within a non-gigantic huge page? My impression was that you can't have a discontiguity at such a small boundary.
No, we can't.
MAX_ORDERallocations from the buddy always completely fit into a memory section.
On ARM64, we have 32M(16*2M) HugeTLB, it maybe not within a mem section, right?
But after v5.13 commit 782276b4d0ad ("arm64: Force SPARSEMEM_VMEMMAP
as the only memory management model"), it looks only old lts, eg, 5.10 could meet this issue.
Quoted 14 lines · Kefeng Wang
Quoted 11 lines · David Hildenbrand
Quoted 9 lines · Matthew Wilcox
Quoted 4 lines · Kefeng Wang
The clear and copy of huge gigantic page has converted to use
nth_page()to handle the possible discontinuous struct page(SPARSEMEM without VMEMMAP),
but not change for the non-gigantic part, fix it too.Can there be discontiguities within a non-gigantic huge page? My impression was that you can't have a discontiguity at such a small boundary.
Quoted 5 lines
Quoted 2 lines
No, we can't.
MAX_ORDERallocations from the buddy always completely fit into a memory section.On ARM64, we have 32M(16*2M) HugeTLB, it maybe not within a mem section, right?
I recall the mem sections are always at least 128 MiB on arm64.
Note that anything > MAX_ORDER is called a "gigantic huge page" in hugetlb code.
Signature · 3 lines
Cheers, David / dhildenb
Quoted 18 lines · David Hildenbrand
Quoted 17 lines · Kefeng Wang
Quoted 13 lines · David Hildenbrand
Quoted 9 lines · Matthew Wilcox
Quoted 4 lines · Kefeng Wang
The clear and copy of huge gigantic page has converted to use
nth_page()to handle the possible discontinuous struct page(SPARSEMEM without VMEMMAP),
but not change for the non-gigantic part, fix it too.Can there be discontiguities within a non-gigantic huge page? My impression was that you can't have a discontiguity at such a small boundary.
No, we can't.
MAX_ORDERallocations from the buddy always completely fit into a memory section.
Quoted 6 lines
Quoted 2 lines
On ARM64, we have 32M(16*2M) HugeTLB, it maybe not within a mem section, right?
I recall the mem sections are always at least 128 MiB on arm64.
Note that anything >
MAX_ORDERis called a "gigantic huge page" in hugetlb code.
Yes, we already check MAX_ORDER, please ignore this one, thanks.