From c1cbc3eebf7a9ae46473a66710c0859aaafc1607 Mon Sep 17 00:00:00 2001 From: Wei Yang Date: Mon, 23 Sep 2019 15:36:27 -0700 Subject: [PATCH] mm/sparse.c: use __nr_to_section(section_nr) to get mem_section __pfn_to_section is defined as __nr_to_section(pfn_to_section_nr(pfn)). Since we already get section_nr, it is not necessary to get mem_section from start_pfn. By doing so, we reduce one redundant operation. Link: http://lkml.kernel.org/r/20190809010242.29797-1-richardw.yang@linux.intel.com Signed-off-by: Wei Yang Reviewed-by: Anshuman Khandual Tested-by: Anshuman Khandual Cc: Oscar Salvador Cc: Pavel Tatashin Cc: Michal Hocko Cc: David Hildenbrand Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- mm/sparse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/sparse.c b/mm/sparse.c index 79355a86064f..a1679024ab5c 100644 --- a/mm/sparse.c +++ b/mm/sparse.c @@ -877,7 +877,7 @@ int __meminit sparse_add_section(int nid, unsigned long start_pfn, */ page_init_poison(pfn_to_page(start_pfn), sizeof(struct page) * nr_pages); - ms = __pfn_to_section(start_pfn); + ms = __nr_to_section(section_nr); set_section_nid(section_nr, nid); section_mark_present(ms);