* Re: [PATCH] mm: page_isolation: use compound_nr() correctly in isolate_single_pageblock()
2022-05-31 2:44 [PATCH] mm: page_isolation: use compound_nr() correctly in isolate_single_pageblock() Zi Yan
@ 2022-05-31 3:12 ` Anshuman Khandual
2022-05-31 5:40 ` Muchun Song
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Anshuman Khandual @ 2022-05-31 3:12 UTC (permalink / raw)
To: Zi Yan, Andrew Morton, David Hildenbrand, linux-mm
Cc: linux-kernel, Qian Cai, Vlastimil Babka, Mel Gorman, Eric Ren,
Mike Rapoport, Oscar Salvador, Christophe Leroy
On 5/31/22 08:14, Zi Yan wrote:
> From: Zi Yan <ziy@nvidia.com>
>
> When compound_nr(page) was used, page was not guaranteed to be the head
> of the compound page and it could cause an infinite loop. Fix it by calling
> it on the head page.
>
> Fixes: b2c9e2fbba32 ("mm: make alloc_contig_range work at pageblock granularity")
> Reported-by: Anshuman Khandual <anshuman.khandual@arm.com>
> Link: https://lore.kernel.org/linux-mm/20220530115027.123341-1-anshuman.khandual@arm.com/
> Signed-off-by: Zi Yan <ziy@nvidia.com>
Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
> ---
> 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 6021f8444b5a..d200d41ad0d3 100644
> --- a/mm/page_isolation.c
> +++ b/mm/page_isolation.c
> @@ -385,9 +385,9 @@ static int isolate_single_pageblock(unsigned long boundary_pfn, int flags,
> * above do the rest. If migration is not possible, just fail.
> */
> if (PageCompound(page)) {
> - unsigned long nr_pages = compound_nr(page);
> struct page *head = compound_head(page);
> unsigned long head_pfn = page_to_pfn(head);
> + unsigned long nr_pages = compound_nr(head);
>
> if (head_pfn + nr_pages <= boundary_pfn) {
> pfn = head_pfn + nr_pages;
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] mm: page_isolation: use compound_nr() correctly in isolate_single_pageblock()
2022-05-31 2:44 [PATCH] mm: page_isolation: use compound_nr() correctly in isolate_single_pageblock() Zi Yan
2022-05-31 3:12 ` Anshuman Khandual
@ 2022-05-31 5:40 ` Muchun Song
2022-05-31 8:56 ` Oscar Salvador
2022-05-31 9:05 ` Miaohe Lin
3 siblings, 0 replies; 5+ messages in thread
From: Muchun Song @ 2022-05-31 5:40 UTC (permalink / raw)
To: Zi Yan
Cc: Andrew Morton, David Hildenbrand, linux-mm, linux-kernel,
Qian Cai, Vlastimil Babka, Mel Gorman, Eric Ren, Mike Rapoport,
Oscar Salvador, Christophe Leroy, Anshuman Khandual
On Mon, May 30, 2022 at 10:44:50PM -0400, Zi Yan wrote:
> From: Zi Yan <ziy@nvidia.com>
>
> When compound_nr(page) was used, page was not guaranteed to be the head
> of the compound page and it could cause an infinite loop. Fix it by calling
> it on the head page.
>
> Fixes: b2c9e2fbba32 ("mm: make alloc_contig_range work at pageblock granularity")
> Reported-by: Anshuman Khandual <anshuman.khandual@arm.com>
> Link: https://lore.kernel.org/linux-mm/20220530115027.123341-1-anshuman.khandual@arm.com/
> Signed-off-by: Zi Yan <ziy@nvidia.com>
Acked-by: Muchun Song <songmuchun@bytedance.com>
Thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] mm: page_isolation: use compound_nr() correctly in isolate_single_pageblock()
2022-05-31 2:44 [PATCH] mm: page_isolation: use compound_nr() correctly in isolate_single_pageblock() Zi Yan
2022-05-31 3:12 ` Anshuman Khandual
2022-05-31 5:40 ` Muchun Song
@ 2022-05-31 8:56 ` Oscar Salvador
2022-05-31 9:05 ` Miaohe Lin
3 siblings, 0 replies; 5+ messages in thread
From: Oscar Salvador @ 2022-05-31 8:56 UTC (permalink / raw)
To: Zi Yan
Cc: Andrew Morton, David Hildenbrand, linux-mm, linux-kernel,
Qian Cai, Vlastimil Babka, Mel Gorman, Eric Ren, Mike Rapoport,
Christophe Leroy, Anshuman Khandual
On Mon, May 30, 2022 at 10:44:50PM -0400, Zi Yan wrote:
> From: Zi Yan <ziy@nvidia.com>
>
> When compound_nr(page) was used, page was not guaranteed to be the head
> of the compound page and it could cause an infinite loop. Fix it by calling
> it on the head page.
>
> Fixes: b2c9e2fbba32 ("mm: make alloc_contig_range work at pageblock granularity")
> Reported-by: Anshuman Khandual <anshuman.khandual@arm.com>
> Link: https://lore.kernel.org/linux-mm/20220530115027.123341-1-anshuman.khandual@arm.com/
> Signed-off-by: Zi Yan <ziy@nvidia.com>
Reviewed-by: Oscar Salvador <osalvador@suse.de>
> ---
> 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 6021f8444b5a..d200d41ad0d3 100644
> --- a/mm/page_isolation.c
> +++ b/mm/page_isolation.c
> @@ -385,9 +385,9 @@ static int isolate_single_pageblock(unsigned long boundary_pfn, int flags,
> * above do the rest. If migration is not possible, just fail.
> */
> if (PageCompound(page)) {
> - unsigned long nr_pages = compound_nr(page);
> struct page *head = compound_head(page);
> unsigned long head_pfn = page_to_pfn(head);
> + unsigned long nr_pages = compound_nr(head);
>
> if (head_pfn + nr_pages <= boundary_pfn) {
> pfn = head_pfn + nr_pages;
> --
> 2.35.1
>
--
Oscar Salvador
SUSE Labs
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] mm: page_isolation: use compound_nr() correctly in isolate_single_pageblock()
2022-05-31 2:44 [PATCH] mm: page_isolation: use compound_nr() correctly in isolate_single_pageblock() Zi Yan
` (2 preceding siblings ...)
2022-05-31 8:56 ` Oscar Salvador
@ 2022-05-31 9:05 ` Miaohe Lin
3 siblings, 0 replies; 5+ messages in thread
From: Miaohe Lin @ 2022-05-31 9:05 UTC (permalink / raw)
To: Zi Yan
Cc: linux-kernel, Qian Cai, Vlastimil Babka, Mel Gorman, Eric Ren,
Mike Rapoport, Oscar Salvador, Christophe Leroy,
Anshuman Khandual, Andrew Morton, David Hildenbrand, linux-mm
On 2022/5/31 10:44, Zi Yan wrote:
> From: Zi Yan <ziy@nvidia.com>
>
> When compound_nr(page) was used, page was not guaranteed to be the head
> of the compound page and it could cause an infinite loop. Fix it by calling
> it on the head page.
>
> Fixes: b2c9e2fbba32 ("mm: make alloc_contig_range work at pageblock granularity")
> Reported-by: Anshuman Khandual <anshuman.khandual@arm.com>
> Link: https://lore.kernel.org/linux-mm/20220530115027.123341-1-anshuman.khandual@arm.com/
> Signed-off-by: Zi Yan <ziy@nvidia.com>
LGTM. Thanks!
Reviewed-by: Miaohe Lin <linmiaohe@huawei.com>
> ---
> 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 6021f8444b5a..d200d41ad0d3 100644
> --- a/mm/page_isolation.c
> +++ b/mm/page_isolation.c
> @@ -385,9 +385,9 @@ static int isolate_single_pageblock(unsigned long boundary_pfn, int flags,
> * above do the rest. If migration is not possible, just fail.
> */
> if (PageCompound(page)) {
> - unsigned long nr_pages = compound_nr(page);
> struct page *head = compound_head(page);
> unsigned long head_pfn = page_to_pfn(head);
> + unsigned long nr_pages = compound_nr(head);
>
> if (head_pfn + nr_pages <= boundary_pfn) {
> pfn = head_pfn + nr_pages;
>
^ permalink raw reply [flat|nested] 5+ messages in thread