From: David Hildenbrand <david@redhat.com>
To: Lance Yang <ioworker0@gmail.com>, akpm@linux-foundation.org
Cc: mhocko@suse.com, zokeefe@google.com, shy828301@gmail.com,
xiehuan09@gmail.com, songmuchun@bytedance.com,
minchan@kernel.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] mm/khugepaged: reduce process visible downtime by pre-zeroing hugepage
Date: Mon, 11 Mar 2024 17:19:26 +0100 [thread overview]
Message-ID: <ef409d5e-5652-4fff-933c-49bda6d75018@redhat.com> (raw)
In-Reply-To: <20240308074921.45752-1-ioworker0@gmail.com>
On 08.03.24 08:49, Lance Yang wrote:
> The patch reduces the process visible downtime during hugepage
> collapse. This is achieved by pre-zeroing the hugepage before
> acquiring mmap_lock(write mode) if nr_pte_none >= 256, without
> affecting the efficiency of khugepaged.
>
> On an Intel Core i5 CPU, the process visible downtime during
> hugepage collapse is as follows:
>
> | nr_ptes_none | w/o __GFP_ZERO | w/ __GFP_ZERO | Change |
> --------------------------------------------------—----------
> | 511 | 233us | 95us | -59.21%|
> | 384 | 376us | 219us | -41.20%|
> | 256 | 421us | 323us | -23.28%|
> | 128 | 523us | 507us | -3.06%|
>
> Of course, alloc_charge_hpage() will take longer to run with
> the __GFP_ZERO flag.
>
> | Func | w/o __GFP_ZERO | w/ __GFP_ZERO |
> |----------------------|----------------|---------------|
> | alloc_charge_hpage | 198us | 295us |
>
> But it's not a big deal because it doesn't impact the total
> time spent by khugepaged in collapsing a hugepage. In fact,
> it would decrease.
It does look sane to me and not overly complicated.
But, it's an optimization really only when we have quite a bunch of
pte_none(), possibly repeatedly so that it really makes a difference.
Usually, when we repeatedly collapse that many pte_none() we're just
wasting a lot of memory and should re-evaluate life choices :)
So my question is: do we really care about it that much that we care to
optimize?
But again, LGTM.
--
Cheers,
David / dhildenb
next prev parent reply other threads:[~2024-03-11 16:19 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-08 7:49 [PATCH 1/1] mm/khugepaged: reduce process visible downtime by pre-zeroing hugepage Lance Yang
2024-03-11 16:19 ` David Hildenbrand [this message]
2024-03-12 13:09 ` Lance Yang
2024-03-12 13:19 ` David Hildenbrand
2024-03-12 13:55 ` Lance Yang
2024-03-14 14:19 ` Lance Yang
2024-03-15 12:18 ` David Hildenbrand
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=ef409d5e-5652-4fff-933c-49bda6d75018@redhat.com \
--to=david@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=ioworker0@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=minchan@kernel.org \
--cc=shy828301@gmail.com \
--cc=songmuchun@bytedance.com \
--cc=xiehuan09@gmail.com \
--cc=zokeefe@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).