From: David Hildenbrand <david@redhat.com>
To: Yang Shi <shy828301@gmail.com>, Zi Yan <ziy@nvidia.com>
Cc: Linux MM <linux-mm@kvack.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
linux-kselftest@vger.kernel.org,
"Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>,
Andrew Morton <akpm@linux-foundation.org>,
Shuah Khan <shuah@kernel.org>, John Hubbard <jhubbard@nvidia.com>,
Sandipan Das <sandipan@linux.ibm.com>,
David Rientjes <rientjes@google.com>,
Alex Shi <alex.shi@linux.alibaba.com>
Subject: Re: [PATCH] mm: huge_memory: a new debugfs interface for splitting THP tests.
Date: Mon, 8 Mar 2021 20:30:45 +0100 [thread overview]
Message-ID: <c530e051-9292-1b2c-3036-70fc1eac3bfa@redhat.com> (raw)
In-Reply-To: <CAHbLzkofsc4_wEGmMFKwkUrc1pg4Y7iZZ9QKAXggiyg8RuOMqA@mail.gmail.com>
On 08.03.21 20:11, Yang Shi wrote:
> On Mon, Mar 8, 2021 at 11:01 AM Zi Yan <ziy@nvidia.com> wrote:
>>
>> On 8 Mar 2021, at 13:11, David Hildenbrand wrote:
>>
>>> On 08.03.21 18:49, Zi Yan wrote:
>>>> On 8 Mar 2021, at 11:17, David Hildenbrand wrote:
>>>>
>>>>> On 08.03.21 16:22, Zi Yan wrote:
>>>>>> From: Zi Yan <ziy@nvidia.com>
>>>>>>
>>>>>> By writing "<pid>,<vaddr_start>,<vaddr_end>" to
>>>>>> <debugfs>/split_huge_pages_in_range_pid, THPs in the process with the
>>>>>> given pid and virtual address range are split. It is used to test
>>>>>> split_huge_page function. In addition, a selftest program is added to
>>>>>> tools/testing/selftests/vm to utilize the interface by splitting
>>>>>> PMD THPs and PTE-mapped THPs.
>>>>>
>>>>> Won't something like
>>>>>
>>>>> 1. MADV_HUGEPAGE
>>>>>
>>>>> 2. Access memory
>>>>>
>>>>> 3. MADV_NOHUGEPAGE
>>>>>
>>>>> Have a similar effect? What's the benefit of this?
>>>>
>>>> Thanks for checking the patch.
>>>>
>>>> No, MADV_NOHUGEPAGE just replaces VM_HUGEPAGE with VM_NOHUGEPAGE,
>>>> nothing else will be done.
>>>
>>> Ah, okay - maybe my memory was tricking me. There is some s390x KVM code that forces MADV_NOHUGEPAGE and force-splits everything.
>>>
>>> I do wonder, though, if this functionality would be worth a proper user interface (e.g., madvise), though. There might be actual benefit in having this as a !debug interface.
>>>
>>> I think you aware of the discussion in https://lkml.kernel.org/r/d098c392-273a-36a4-1a29-59731cdf5d3d@google.com
>>
>> Yes. Thanks for bringing this up.
>>
>>>
>>> If there will be an interface to collapse a THP -- "this memory area is worth extra performance now by collapsing a THP if possible" -- it might also be helpful to have the opposite functionality -- "this memory area is not worth a THP, rather use that somehwere else".
>>>
>>> MADV_HUGE_COLLAPSE vs. MADV_HUGE_SPLIT
>>
>> I agree that MADV_HUGE_SPLIT would be useful as the opposite of COLLAPSE when user might just want PAGESIZE mappings.
>> Right now, HUGE_SPLIT is implicit from mapping changes like mprotect or MADV_DONTNEED.
>
> IMHO, it sounds not very useful. MADV_DONTNEED would split PMD for any
> partial THP. If the range covers the whole THP, the whole THP is going
> to be freed anyway. All other places in kernel which need split THP
> have been covered. So I didn't realize any usecase from userspace for
> just splitting PMD to PTEs.
THP are a limited resource. So indicating which virtual memory regions
are not performance sensitive right now (e.g., cold pages in a databse)
and not worth a THP might be quite valuable, no?
--
Thanks,
David / dhildenb
next prev parent reply other threads:[~2021-03-08 19:31 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-08 15:22 [PATCH] mm: huge_memory: a new debugfs interface for splitting THP tests Zi Yan
2021-03-08 16:17 ` David Hildenbrand
2021-03-08 17:49 ` Zi Yan
2021-03-08 18:11 ` David Hildenbrand
2021-03-08 19:01 ` Zi Yan
2021-03-08 19:11 ` Yang Shi
2021-03-08 19:30 ` David Hildenbrand [this message]
2021-03-08 20:18 ` Yang Shi
2021-03-08 20:35 ` David Hildenbrand
2021-03-08 21:25 ` Yang Shi
2021-03-08 21:58 ` David Hildenbrand
2021-03-08 22:20 ` Yang Shi
[not found] ` <590175ca-ccf8-45d2-c108-e6225451e68a@nextfour.com>
[not found] ` <efac8763-8706-7b0b-17b9-4b0a4538fbf1@nextfour.com>
2021-03-08 18:46 ` Zi Yan
2021-03-08 19:23 ` kernel test robot
2021-03-08 19:36 ` Zi Yan
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=c530e051-9292-1b2c-3036-70fc1eac3bfa@redhat.com \
--to=david@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=alex.shi@linux.alibaba.com \
--cc=jhubbard@nvidia.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=rientjes@google.com \
--cc=sandipan@linux.ibm.com \
--cc=shuah@kernel.org \
--cc=shy828301@gmail.com \
--cc=ziy@nvidia.com \
/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;
as well as URLs for NNTP newsgroup(s).