From: Muchun Song <songmuchun@bytedance.com>
To: Mike Kravetz <mike.kravetz@oracle.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
Linux Memory Management List <linux-mm@kvack.org>,
David Hildenbrand <david@redhat.com>,
Naoya Horiguchi <naoya.horiguchi@linux.dev>,
Axel Rasmussen <axelrasmussen@google.com>,
Dave Hansen <dave.hansen@intel.com>,
Michal Hocko <mhocko@suse.com>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] hugetlbfs: zero partial pages during fallocate hole punch
Date: Tue, 14 Jun 2022 23:03:55 +0800 [thread overview]
Message-ID: <CAMZfGtWUheQWeFNF0jgpttbMV9gBjFtZzaOar2gGvUTRx5h8bQ@mail.gmail.com> (raw)
In-Reply-To: <YqeiMlZDKI1Kabfe@monkey>
On Tue, Jun 14, 2022 at 4:46 AM Mike Kravetz <mike.kravetz@oracle.com> wrote:
>
> Below is v2 of the patch. I was just going to change the type of start/end
> hugetlbfs_zero_partial_page arguments. However, Matthew also convinced me
> to do the simple folio conversion. Tested with new libhugetlbfs code.
>
>
> From 36a18e0b07c2e189092cc2d516e8cfedcb57d191 Mon Sep 17 00:00:00 2001
> From: Mike Kravetz <mike.kravetz@oracle.com>
> Date: Mon, 13 Jun 2022 13:36:48 -0700
> Subject: [Patch v2] hugetlbfs: zero partial pages during fallocate hole punch
>
> hugetlbfs fallocate support was originally added with commit 70c3547e36f5
> ("hugetlbfs: add hugetlbfs_fallocate()"). Initial support only operated
> on whole hugetlb pages. This makes sense for populating files as other
> interfaces such as mmap and truncate require hugetlb page size alignment.
> Only operating on whole hugetlb pages for the hole punch case was a
> simplification and there was no compelling use case to zero partial pages.
>
> In a recent discussion[1] it was assumed that hugetlbfs hole punch would
> zero partial hugetlb pages as that is in line with the man page
> description saying 'partial filesystem blocks are zeroed'. However,
> the hugetlbfs hole punch code actually does this:
>
> hole_start = round_up(offset, hpage_size);
> hole_end = round_down(offset + len, hpage_size);
>
> Modify code to zero partial hugetlb pages in hole punch range. It is
> possible that application code could note a change in behavior. However,
> that would imply the code is passing in an unaligned range and expecting
> only whole pages be removed. This is unlikely as the fallocate
> documentation states the opposite.
>
> The current hugetlbfs fallocate hole punch behavior is tested with the
> libhugetlbfs test fallocate_align[2]. This test will be updated to
> validate partial page zeroing.
>
> [1] https://lore.kernel.org/linux-mm/20571829-9d3d-0b48-817c-b6b15565f651@redhat.com/
> [2] https://github.com/libhugetlbfs/libhugetlbfs/blob/master/tests/fallocate_align.c
>
> Signed-off-by: Mike Kravetz <mike.kravetz@oracle.com>
LGTM.
Reviewed-by: Muchun Song <songmuchun@bytedance.com>
Thanks.
prev parent reply other threads:[~2022-06-14 15:04 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-13 18:08 Mike Kravetz
2022-06-13 18:30 ` Matthew Wilcox
2022-06-13 18:36 ` Mike kravetz
2022-06-13 18:57 ` Andrew Morton
2022-06-13 20:11 ` Mike Kravetz
2022-06-13 20:46 ` Mike Kravetz
2022-06-14 15:03 ` Muchun Song [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=CAMZfGtWUheQWeFNF0jgpttbMV9gBjFtZzaOar2gGvUTRx5h8bQ@mail.gmail.com \
--to=songmuchun@bytedance.com \
--cc=akpm@linux-foundation.org \
--cc=axelrasmussen@google.com \
--cc=dave.hansen@intel.com \
--cc=david@redhat.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 \
/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