From: Mike Kravetz <mike.kravetz@oracle.com>
To: Joao Martins <joao.m.martins@oracle.com>, linux-mm@kvack.org
Cc: linux-kernel@vger.kernel.org, Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH v2 2/2] mm/hugetlb: refactor subpage recording
Date: Thu, 28 Jan 2021 13:53:15 -0800 [thread overview]
Message-ID: <b550e766-b0fd-2c99-c82f-80e770e8a496@oracle.com> (raw)
In-Reply-To: <20210128182632.24562-3-joao.m.martins@oracle.com>
On 1/28/21 10:26 AM, Joao Martins wrote:
> For a given hugepage backing a VA, there's a rather ineficient
> loop which is solely responsible for storing subpages in GUP
> @pages/@vmas array. For each subpage we check whether it's within
> range or size of @pages and keep increment @pfn_offset and a couple
> other variables per subpage iteration.
>
> Simplify this logic and minimize the cost of each iteration to just
> store the output page/vma. Instead of incrementing number of @refs
> iteratively, we do it through pre-calculation of @refs and only
> with a tight loop for storing pinned subpages/vmas.
>
> Additionally, retain existing behaviour with using mem_map_offset()
> when recording the subpages for configurations that don't have a
> contiguous mem_map.
>
> pinning consequently improves bringing us close to
> {pin,get}_user_pages_fast:
>
> - 16G with 1G huge page size
> gup_test -f /mnt/huge/file -m 16384 -r 30 -L -S -n 512 -w
>
> PIN_LONGTERM_BENCHMARK: ~12.8k us -> ~5.8k us
> PIN_FAST_BENCHMARK: ~3.7k us
>
> Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
> ---
> mm/hugetlb.c | 49 ++++++++++++++++++++++++++++---------------------
> 1 file changed, 28 insertions(+), 21 deletions(-)
Thanks for updating this.
Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com>
I think there still is an open general question about whether we can always
assume page structs are contiguous for really big pages. That is outside
the scope of this patch. Adding the mem_map_offset() keeps this consistent
with other hugetlbfs specific code.
--
Mike Kravetz
next prev parent reply other threads:[~2021-01-28 21:56 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-28 18:26 [PATCH v2 0/2] mm/hugetlb: follow_hugetlb_page() improvements Joao Martins
2021-01-28 18:26 ` [PATCH v2 1/2] mm/hugetlb: grab head page refcount once for group of subpages Joao Martins
2021-01-28 18:26 ` [PATCH v2 2/2] mm/hugetlb: refactor subpage recording Joao Martins
2021-01-28 21:53 ` Mike Kravetz [this message]
2021-02-11 20:47 ` Zi Yan
2021-02-11 23:44 ` Mike Kravetz
2021-02-13 15:44 ` Zi Yan
2021-02-13 21:04 ` Mike Kravetz
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=b550e766-b0fd-2c99-c82f-80e770e8a496@oracle.com \
--to=mike.kravetz@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=joao.m.martins@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
/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