Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mm/sparse: remove !CONFIG_SPARSEMEM_VMEMMAP leftovers for CONFIG_MEMORY_HOTPLUG

CONFIG_MEMORY_HOTPLUG now depends on CONFIG_SPARSEMEM_VMEMMAP. So let's
remove the !CONFIG_SPARSEMEM_VMEMMAP leftovers that are dead code.

Adjust the comment above fill_subsection_map() accordingly.

Link: https://lkml.kernel.org/r/20260320-sparsemem_cleanups-v2-6-096addc8800d@kernel.org
Signed-off-by: David Hildenbrand (Arm) <david@kernel.org>
Reviewed-by: Lorenzo Stoakes (Oracle) <ljs@kernel.org>
Reviewed-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
Cc: Axel Rasmussen <axelrasmussen@google.com>
Cc: Liam Howlett <liam.howlett@oracle.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Oscar Salvador <osalvador@suse.de>
Cc: Sidhartha Kumar <sidhartha.kumar@oracle.com>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Vlastimil Babka <vbabka@kernel.org>
Cc: Wei Xu <weixugc@google.com>
Cc: Yuanchu Xie <yuanchu@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

David Hildenbrand (Arm) and committed by
Andrew Morton
119c31ca 62257a5f

+2 -67
+2 -67
mm/sparse.c
··· 657 657 } 658 658 } 659 659 660 - #ifdef CONFIG_SPARSEMEM_VMEMMAP 661 660 static struct page * __meminit populate_section_memmap(unsigned long pfn, 662 661 unsigned long nr_pages, int nid, struct vmem_altmap *altmap, 663 662 struct dev_pagemap *pgmap) ··· 728 729 729 730 return rc; 730 731 } 731 - #else 732 - static struct page * __meminit populate_section_memmap(unsigned long pfn, 733 - unsigned long nr_pages, int nid, struct vmem_altmap *altmap, 734 - struct dev_pagemap *pgmap) 735 - { 736 - return kvmalloc_node(array_size(sizeof(struct page), 737 - PAGES_PER_SECTION), GFP_KERNEL, nid); 738 - } 739 - 740 - static void depopulate_section_memmap(unsigned long pfn, unsigned long nr_pages, 741 - struct vmem_altmap *altmap) 742 - { 743 - kvfree(pfn_to_page(pfn)); 744 - } 745 - 746 - static void free_map_bootmem(struct page *memmap) 747 - { 748 - unsigned long maps_section_nr, removing_section_nr, i; 749 - unsigned long type, nr_pages; 750 - struct page *page = virt_to_page(memmap); 751 - 752 - nr_pages = PAGE_ALIGN(PAGES_PER_SECTION * sizeof(struct page)) 753 - >> PAGE_SHIFT; 754 - 755 - for (i = 0; i < nr_pages; i++, page++) { 756 - type = bootmem_type(page); 757 - 758 - BUG_ON(type == NODE_INFO); 759 - 760 - maps_section_nr = pfn_to_section_nr(page_to_pfn(page)); 761 - removing_section_nr = bootmem_info(page); 762 - 763 - /* 764 - * When this function is called, the removing section is 765 - * logical offlined state. This means all pages are isolated 766 - * from page allocator. If removing section's memmap is placed 767 - * on the same section, it must not be freed. 768 - * If it is freed, page allocator may allocate it which will 769 - * be removed physically soon. 770 - */ 771 - if (maps_section_nr != removing_section_nr) 772 - put_page_bootmem(page); 773 - } 774 - } 775 - 776 - static int clear_subsection_map(unsigned long pfn, unsigned long nr_pages) 777 - { 778 - return 0; 779 - } 780 - 781 - static bool is_subsection_map_empty(struct mem_section *ms) 782 - { 783 - return true; 784 - } 785 - 786 - static int fill_subsection_map(unsigned long pfn, unsigned long nr_pages) 787 - { 788 - return 0; 789 - } 790 - #endif /* CONFIG_SPARSEMEM_VMEMMAP */ 791 732 792 733 /* 793 - * To deactivate a memory region, there are 3 cases to handle across 794 - * two configurations (SPARSEMEM_VMEMMAP={y,n}): 734 + * To deactivate a memory region, there are 3 cases to handle: 795 735 * 796 - * 1. deactivation of a partial hot-added section (only possible in 797 - * the SPARSEMEM_VMEMMAP=y case). 736 + * 1. deactivation of a partial hot-added section: 798 737 * a) section was present at memory init. 799 738 * b) section was hot-added post memory init. 800 739 * 2. deactivation of a complete hot-added section. ··· 740 803 * 741 804 * For 1, when subsection_map does not empty we will not be freeing the 742 805 * usage map, but still need to free the vmemmap range. 743 - * 744 - * For 2 and 3, the SPARSEMEM_VMEMMAP={y,n} cases are unified 745 806 */ 746 807 static void section_deactivate(unsigned long pfn, unsigned long nr_pages, 747 808 struct vmem_altmap *altmap)