From: Zi Yan <ziy@nvidia.com>
To: "\"Philippe Mathieu-Daudé\"" <philmd@linaro.org>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
linux-mips@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>,
Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
"\"Matthew Wilcox (Oracle)\"" <willy@infradead.org>,
David Hildenbrand <david@redhat.com>,
Mike Kravetz <mike.kravetz@oracle.com>,
Muchun Song <muchun.song@linux.dev>,
"\"Mike Rapoport (IBM)\"" <rppt@kernel.org>
Subject: Re: [PATCH v2 0/5] Use nth_page() in place of direct struct page manipulation
Date: Fri, 08 Sep 2023 10:56:46 -0400 [thread overview]
Message-ID: <7122A099-A01A-4B49-8391-E070E661E4B7@nvidia.com> (raw)
In-Reply-To: <59cc930c-3efd-d31e-49c3-2778914ea9ae@linaro.org>
[-- Attachment #1: Type: text/plain, Size: 1345 bytes --]
On 8 Sep 2023, at 10:46, Philippe Mathieu-Daudé wrote:
> Hi,
>
> On 6/9/23 17:03, Zi Yan wrote:
>> 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.
>
> How can we notice "whenever code can see hugetlb pages"?
> From your series it seems you did a manual code audit, is that correct?
> (I ask because I'm wondering about code scalability and catching other
> cases).
Anything allocated from buddy allocator should be free of this problem,
because MAX_ORDER is always smaller than a memory section size. This means
majority of kernel code should be fine. What is left is core mm code that
can have a chance to touch hugetlb, like migration, memory compaction,
and of course hugetlb code. Yes, I did a manual code audit. And hopefully
I caught all cases.
An alternative is to use nth_page() everywhere, but that is a very invasive
change for an uncommon config (SPARSEMEM + !VMEMMAP).
--
Best Regards,
Yan, Zi
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 854 bytes --]
prev parent reply other threads:[~2023-09-08 14:56 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-06 15:03 Zi Yan
2023-09-06 15:03 ` [PATCH v2 1/5] mm/cma: use " Zi Yan
2023-09-06 15:03 ` [PATCH v2 2/5] mm/hugetlb: " Zi Yan
2023-09-06 15:03 ` [PATCH v2 3/5] mm/memory_hotplug: " Zi Yan
2023-09-06 17:17 ` David Hildenbrand
2023-09-06 17:39 ` Zi Yan
2023-09-06 17:46 ` Zi Yan
2023-09-06 15:03 ` [PATCH v2 4/5] fs: " Zi Yan
2023-09-06 15:03 ` [PATCH v2 5/5] mips: " Zi Yan
2023-09-08 14:46 ` [PATCH v2 0/5] Use " Philippe Mathieu-Daudé
2023-09-08 14:56 ` Zi Yan [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7122A099-A01A-4B49-8391-E070E661E4B7@nvidia.com \
--to=ziy@nvidia.com \
--cc=akpm@linux-foundation.org \
--cc=david@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mike.kravetz@oracle.com \
--cc=muchun.song@linux.dev \
--cc=philmd@linaro.org \
--cc=rppt@kernel.org \
--cc=tsbogend@alpha.franken.de \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox