]> git.baikalelectronics.ru Git - kernel.git/commit
mm: sparsemem: fix missing higher order allocation splitting
authorMuchun Song <songmuchun@bytedance.com>
Mon, 20 Jun 2022 02:30:19 +0000 (10:30 +0800)
committerakpm <akpm@linux-foundation.org>
Sun, 3 Jul 2022 22:42:32 +0000 (15:42 -0700)
commit4ae8676d5bd4ce63fb8ec1abb915b9e9829d8d71
tree2fcd0b436daaf0006096d44951f4adc7fe08f6b2
parent35e38917a81509ba97ef268f29144a0ebf9251eb
mm: sparsemem: fix missing higher order allocation splitting

Higher order allocations for vmemmap pages from buddy allocator must be
able to be treated as indepdenent small pages as they can be freed
individually by the caller.  There is no problem for higher order vmemmap
pages allocated at boot time since each individual small page will be
initialized at boot time.  However, it will be an issue for memory hotplug
case since those higher order vmemmap pages are allocated from buddy
allocator without initializing each individual small page's refcount.  The
system will panic in put_page_testzero() when CONFIG_DEBUG_VM is enabled
if the vmemmap page is freed.

Link: https://lkml.kernel.org/r/20220620023019.94257-1-songmuchun@bytedance.com
Fixes: 5d779d36c6f5 ("mm: sparsemem: use page table lock to protect kernel pmd operations")
Signed-off-by: Muchun Song <songmuchun@bytedance.com>
Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com>
Cc: Xiongchun Duan <duanxiongchun@bytedance.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/sparse-vmemmap.c