Re: [PATCH] mm/hugetlb: correct demote page offset logic

From: Mike Kravetz
Date: Wed Sep 14 2022 - 17:19:50 EST


On 09/14/22 12:09, Doug Berger wrote:
> With gigantic pages it may not be true that struct page structures
> are contiguous across the entire gigantic page. The nth_page macro
> is used here in place of direct pointer arithmetic to correct for
> this.
>
> Fixes: 8531fc6f52f5 ("hugetlb: add hugetlb demote page support")
> Signed-off-by: Doug Berger <opendmb@xxxxxxxxx>
> Cc: <stable@xxxxxxxxxxxxxxx>
> ---
> mm/hugetlb.c | 14 ++++++++------
> 1 file changed, 8 insertions(+), 6 deletions(-)

Thanks!

Reviewed-by: Mike Kravetz <mike.kravetz@xxxxxxxxxx>

To answer Andrew's question about user-visible runtime effects.
We could get addressing exceptions. However, this is only possible in
configurations where CONFIG_SPARSEMEM && !CONFIG_SPARSEMEM_VMEMMAP.
Such a configuration option is rare an unknown to be the default
anywhere.
--
Mike Kravetz