mm: hugetlb_vmemmap: optimize vmemmap_optimize_mode handling
authorMuchun Song <songmuchun@bytedance.com>
Tue, 28 Jun 2022 09:22:29 +0000 (17:22 +0800)
committerAndrew Morton <akpm@linux-foundation.org>
Tue, 9 Aug 2022 01:06:42 +0000 (18:06 -0700)
commitcf5472e561133888df81d2e48f7da9ebd3299459
tree9fa0200e74d8b9cb2ce833ffa8a86667bc67990f
parent2da1c30929a28c3c6b01d9c16c4216037be95597
mm: hugetlb_vmemmap: optimize vmemmap_optimize_mode handling

We hold an another reference to hugetlb_optimize_vmemmap_key when making
vmemmap_optimize_mode on, because we use static_key to tell memory_hotplug
that memory_hotplug.memmap_on_memory should be overridden.  However, this
rule has gone when we have introduced PageVmemmapSelfHosted.  Therefore,
we could simplify vmemmap_optimize_mode handling by not holding an another
reference to hugetlb_optimize_vmemmap_key.  This also means that we not
incur the extra page_fixed_fake_head checks if there are no vmemmap
optinmized hugetlb pages after this change.

Link: https://lkml.kernel.org/r/20220628092235.91270-3-songmuchun@bytedance.com
Signed-off-by: Muchun Song <songmuchun@bytedance.com>
Reviewed-by: Oscar Salvador <osalvador@suse.de>
Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com>
Cc: Anshuman Khandual <anshuman.khandual@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Will Deacon <will@kernel.org>
Cc: Xiongchun Duan <duanxiongchun@bytedance.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
include/linux/page-flags.h
mm/hugetlb_vmemmap.c