This is a note to let you know that I've just added the patch titled mm: use __pfn_to_section() instead of open coding it to the 5.15-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: mm-use-__pfn_to_section-instead-of-open-coding-it.patch and it can be found in the queue-5.15 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. commit dfd6261dddcc299b40b8d5cbe3e7023f2e295cee Author: Rolf Eike Beer <eb@xxxxxxxxx> Date: Fri Nov 5 13:38:15 2021 -0700 mm: use __pfn_to_section() instead of open coding it [ Upstream commit f1dc0db296bd25960273649fc6ef2ecbf5aaa0e0 ] It is defined in the same file just a few lines above. Link: https://lkml.kernel.org/r/4598487.Rc0NezkW7i@xxxxxxxxxxxxxxxxxxxxxx Signed-off-by: Rolf Eike Beer <eb@xxxxxxxxx> Reviewed-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> Signed-off-by: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> Stable-dep-of: 5ec8e8ea8b77 ("mm/sparsemem: fix race in accessing memory_section->usage") Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx> diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 6ba100216530..9e1485083398 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -1493,7 +1493,7 @@ static inline int pfn_valid(unsigned long pfn) if (pfn_to_section_nr(pfn) >= NR_MEM_SECTIONS) return 0; - ms = __nr_to_section(pfn_to_section_nr(pfn)); + ms = __pfn_to_section(pfn); if (!valid_section(ms)) return 0; /* @@ -1508,7 +1508,7 @@ static inline int pfn_in_present_section(unsigned long pfn) { if (pfn_to_section_nr(pfn) >= NR_MEM_SECTIONS) return 0; - return present_section(__nr_to_section(pfn_to_section_nr(pfn))); + return present_section(__pfn_to_section(pfn)); } static inline unsigned long next_present_section_nr(unsigned long section_nr)