]> git.baikalelectronics.ru Git - kernel.git/commit
mm/hugetlb: correct demote page offset logic
authorDoug Berger <opendmb@gmail.com>
Wed, 14 Sep 2022 19:09:17 +0000 (12:09 -0700)
committerAndrew Morton <akpm@linux-foundation.org>
Mon, 26 Sep 2022 19:14:34 +0000 (12:14 -0700)
commit6a751a2b44f47d0bc2b2a8fa35c00b2f90b5c53d
treef244845d33ab1e283634f49a5ef224ee85aa2700
parentcd8d94648e50965e3e957a725b9e0439330c60a3
mm/hugetlb: correct demote page offset logic

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.

Mike said:

: This error could cause addressing exceptions.  However, this is only
: possible in configurations where CONFIG_SPARSEMEM &&
: !CONFIG_SPARSEMEM_VMEMMAP.  Such a configuration option is rare and
: unknown to be the default anywhere.

Link: https://lkml.kernel.org/r/20220914190917.3517663-1-opendmb@gmail.com
Fixes: 18cdd059edf6 ("hugetlb: add hugetlb demote page support")
Signed-off-by: Doug Berger <opendmb@gmail.com>
Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com>
Reviewed-by: Oscar Salvador <osalvador@suse.de>
Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
Cc: Muchun Song <songmuchun@bytedance.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/hugetlb.c