Message ID | 20230913201248.452081-1-zi.yan@sent.com (mailing list archive) |
---|---|
Headers | show |
Series | Use nth_page() in place of direct struct page manipulation | expand |
On Wed, 13 Sep 2023 16:12:43 -0400 Zi Yan <zi.yan@sent.com> wrote: > On SPARSEMEM without VMEMMAP, struct page is not guaranteed to be > contiguous, since each memory section's memmap might be allocated > independently. hugetlb pages can go beyond a memory section size, thus > direct struct page manipulation on hugetlb pages/subpages might give > wrong struct page. Kernel provides nth_page() to do the manipulation > properly. Use that whenever code can see hugetlb pages. for (each patch) { Can we please explain why -stable backporting is recommended? Such an explanation will, as always, include a description of the user-visible effects of the bug. Some of the Fixes: targets are very old: 5 years. Has something changed to bring these flaws to light? Or is it from code inspection? } Thanks.
From: Zi Yan <ziy@nvidia.com> On SPARSEMEM without VMEMMAP, struct page is not guaranteed to be contiguous, since each memory section's memmap might be allocated independently. hugetlb pages can go beyond a memory section size, thus direct struct page manipulation on hugetlb pages/subpages might give wrong struct page. Kernel provides nth_page() to do the manipulation properly. Use that whenever code can see hugetlb pages. The patches are on top of next-20230913 Changes: From v2: 1. Fixed the subject and the commit log of Patch 3 (David Hildenbrand) From v1: 1. Separated first patch into three and add Fixes for better backport. Zi Yan (5): mm/cma: use nth_page() in place of direct struct page manipulation. mm/hugetlb: use nth_page() in place of direct struct page manipulation. mm/memory_hotplug: use pfn math in place of direct struct page manipulation. fs: use nth_page() in place of direct struct page manipulation. mips: use nth_page() in place of direct struct page manipulation. arch/mips/mm/cache.c | 2 +- fs/hugetlbfs/inode.c | 4 ++-- mm/cma.c | 2 +- mm/hugetlb.c | 2 +- mm/memory_hotplug.c | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-)