From: Mike Kravetz <mike.kravetz@oracle.com>
To: Muchun Song <songmuchun@bytedance.com>,
corbet@lwn.net, akpm@linux-foundation.org, mcgrof@kernel.org,
keescook@chromium.org, yzaikin@google.com, osalvador@suse.de,
david@redhat.com, masahiroy@kernel.org
Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-mm@kvack.org, duanxiongchun@bytedance.com,
smuchun@gmail.com
Subject: Re: [PATCH v10 4/4] mm: hugetlb_vmemmap: add hugetlb_optimize_vmemmap sysctl
Date: Tue, 10 May 2022 17:39:40 -0700 [thread overview]
Message-ID: <9d64809f-db8c-0a3e-1ae9-d4a8ab79041e@oracle.com> (raw)
In-Reply-To: <970166e0-f70e-dd2a-c764-af23a8425f87@oracle.com>
On 5/10/22 14:30, Mike Kravetz wrote:
> On 5/8/22 23:27, Muchun Song wrote:
>> diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h
>> index 029fb7e26504..917112661b5c 100644
>> --- a/include/linux/memory_hotplug.h
>> +++ b/include/linux/memory_hotplug.h
>> @@ -351,4 +351,13 @@ void arch_remove_linear_mapping(u64 start, u64 size);
>> extern bool mhp_supports_memmap_on_memory(unsigned long size);
>> #endif /* CONFIG_MEMORY_HOTPLUG */
>>
>> +#ifdef CONFIG_MHP_MEMMAP_ON_MEMORY
>> +bool mhp_memmap_on_memory(void);
>> +#else
>> +static inline bool mhp_memmap_on_memory(void)
>> +{
>> + return false;
>> +}
>> +#endif
>> +
>> #endif /* __LINUX_MEMORY_HOTPLUG_H */
>> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
>> index 8605d7eb7f5c..86158eb9da70 100644
>> --- a/mm/hugetlb.c
>> +++ b/mm/hugetlb.c
>> @@ -1617,6 +1617,9 @@ static DECLARE_WORK(free_hpage_work, free_hpage_workfn);
>>
>> static inline void flush_free_hpage_work(struct hstate *h)
>> {
>> + if (!hugetlb_optimize_vmemmap_enabled())
>> + return;
>> +
>
> Hi Muchun,
>
> In v9 I was suggesting that we may be able to eliminate the static_branch_inc/dec from the vmemmap free/alloc paths. With this patch
> I believe hugetlb_optimize_vmemmap_enabled() is really checking
> 'has hugetlb vmemmap optimization been enabled' OR 'are there still vmemmap
> optimized hugetlb pages in the system'. That may be confusing.
>
Sorry, I forgot about the use of hugetlb_optimize_vmemmap_enabled in
page_fixed_fake_head. We need to know if there are any vmemmap optimized
hugetlb pages in the system in this performance sensitive path. So,
static_branch_inc/dec is indeed a good idea.
Please disregard my attempt below at removing static_branch_inc/dec.
I still find the name hugetlb_optimize_vmemmap_enabled a bit confusing as
it tests two conditions (enabled and pages in use).
You have already 'open coded' just the check for enabled in the routine
hugetlb_vmemmap_free with:
READ_ONCE(vmemmap_optimize_mode) == VMEMMAP_OPTIMIZE_OFF
How about having hugetlb_optimize_vmemmap_enabled() just check
vmemmap_optimize_mode in a manner like above? Then rename
hugetlb_optimize_vmemmap_enabled to something like:
hugetlb_optimized_vmemmap_possible(). Sorry, I can think if a great name.
--
Mike Kravetz
next prev parent reply other threads:[~2022-05-11 0:40 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-09 6:26 [PATCH v10 0/4] add hugetlb_optimize_vmemmap sysctl Muchun Song
2022-05-09 6:27 ` [PATCH v10 1/4] mm: hugetlb_vmemmap: disable hugetlb_optimize_vmemmap when struct page crosses page boundaries Muchun Song
2022-05-12 7:35 ` David Hildenbrand
2022-05-09 6:27 ` [PATCH v10 2/4] mm: memory_hotplug: override memmap_on_memory when hugetlb_free_vmemmap=on Muchun Song
2022-05-12 7:36 ` David Hildenbrand
2022-05-12 12:50 ` Muchun Song
2022-05-12 13:04 ` David Hildenbrand
2022-05-12 13:59 ` Muchun Song
2022-05-12 16:38 ` David Hildenbrand
2022-05-09 6:27 ` [PATCH v10 3/4] mm: hugetlb_vmemmap: use kstrtobool for hugetlb_vmemmap param parsing Muchun Song
2022-05-12 7:41 ` David Hildenbrand
2022-05-12 11:23 ` Muchun Song
2022-05-09 6:27 ` [PATCH v10 4/4] mm: hugetlb_vmemmap: add hugetlb_optimize_vmemmap sysctl Muchun Song
2022-05-10 21:30 ` Mike Kravetz
2022-05-11 0:39 ` Mike Kravetz [this message]
2022-05-11 9:45 ` Muchun Song
2022-05-11 10:57 ` Muchun Song
2022-05-11 17:53 ` Mike Kravetz
2022-05-12 3:34 ` Muchun Song
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=9d64809f-db8c-0a3e-1ae9-d4a8ab79041e@oracle.com \
--to=mike.kravetz@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=corbet@lwn.net \
--cc=david@redhat.com \
--cc=duanxiongchun@bytedance.com \
--cc=keescook@chromium.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=masahiroy@kernel.org \
--cc=mcgrof@kernel.org \
--cc=osalvador@suse.de \
--cc=smuchun@gmail.com \
--cc=songmuchun@bytedance.com \
--cc=yzaikin@google.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).