From: Andrew Morton <akpm@linux-foundation.org>
To: Mike Kravetz <mike.kravetz@oracle.com>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Jiaqi Yan <jiaqiyan@google.com>,
Naoya Horiguchi <naoya.horiguchi@linux.dev>,
Muchun Song <songmuchun@bytedance.com>,
Miaohe Lin <linmiaohe@huawei.com>,
Axel Rasmussen <axelrasmussen@google.com>,
James Houghton <jthoughton@google.com>,
Michal Hocko <mhocko@suse.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: Re: [PATCH 0/2] Fix hugetlb free path race with memory errors
Date: Thu, 13 Jul 2023 10:34:07 -0700 [thread overview]
Message-ID: <20230713103407.902e24dc90e85a9779ba885c@linux-foundation.org> (raw)
In-Reply-To: <20230711220942.43706-1-mike.kravetz@oracle.com>
On Tue, 11 Jul 2023 15:09:40 -0700 Mike Kravetz <mike.kravetz@oracle.com> wrote:
> In the discussion of Jiaqi Yan's series "Improve hugetlbfs read on
> HWPOISON hugepages" the race window was discovered.
> https://lore.kernel.org/linux-mm/20230616233447.GB7371@monkey/
>
> Freeing a hugetlb page back to low level memory allocators is performed
> in two steps.
> 1) Under hugetlb lock, remove page from hugetlb lists and clear destructor
> 2) Outside lock, allocate vmemmap if necessary and call low level free
> Between these two steps, the hugetlb page will appear as a normal
> compound page. However, vmemmap for tail pages could be missing.
> If a memory error occurs at this time, we could try to update page
> flags non-existant page structs.
>
> A much more detailed description is in the first patch.
>
> The first patch addresses the race window. However, it adds a
> hugetlb_lock lock/unlock cycle to every vmemmap optimized hugetlb
> page free operation. This could lead to slowdowns if one is freeing
> a large number of hugetlb pages.
>
> The second path optimizes the update_and_free_pages_bulk routine
> to only take the lock once in bulk operations.
>
> The second patch is technically not a bug fix, but includes a Fixes
> tag and Cc stable to avoid a performance regression. It can be
> combined with the first, but was done separately make reviewing easier.
>
I feel that backporting performance improvements into -stable is not a
usual thing to do. Perhaps the fact that it's a regression fix changes
this, but why?
Much hinges on the magnitude of the performance change. Are you able
to quantify this at all?
prev parent reply other threads:[~2023-07-13 17:34 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-11 22:09 Mike Kravetz
2023-07-11 22:09 ` [PATCH 1/2] hugetlb: Do not clear hugetlb dtor until allocating vmemmap Mike Kravetz
2023-07-12 8:03 ` Muchun Song
2023-07-12 18:14 ` Mike Kravetz
2023-07-13 0:22 ` Mike Kravetz
2023-07-11 22:09 ` [PATCH 2/2] hugetlb: optimize update_and_free_pages_bulk to avoid lock cycles Mike Kravetz
2023-07-13 17:34 ` Andrew Morton [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=20230713103407.902e24dc90e85a9779ba885c@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=axelrasmussen@google.com \
--cc=gregkh@linuxfoundation.org \
--cc=jiaqiyan@google.com \
--cc=jthoughton@google.com \
--cc=linmiaohe@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=mike.kravetz@oracle.com \
--cc=naoya.horiguchi@linux.dev \
--cc=songmuchun@bytedance.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