From: Matthew Wilcox <willy@infradead.org>
To: Wei Yang <richard.weiyang@gmail.com>
Cc: akpm@linux-foundation.org, rppt@kernel.org, linux-mm@kvack.org,
David Hildenbrand <david@redhat.com>
Subject: Re: [PATCH 4/4] mm/page_alloc: no need to ClearPageReserved on giving page to buddy system
Date: Sat, 29 Jun 2024 17:28:34 +0100 [thread overview]
Message-ID: <ZoA2MmX5FMG58PCP@casper.infradead.org> (raw)
In-Reply-To: <20240629084411.pto6h3vsbxhq64ii@master>
On Sat, Jun 29, 2024 at 08:44:11AM +0000, Wei Yang wrote:
> On Sat, Jun 29, 2024 at 04:21:59AM +0100, Matthew Wilcox wrote:
> >On Sat, Jun 29, 2024 at 01:33:22AM +0000, Wei Yang wrote:
> >> +++ b/mm/page_alloc.c
> >> @@ -1232,10 +1232,8 @@ void __meminit __free_pages_core(struct page *page, unsigned int order)
> >> prefetchw(p);
> >> for (loop = 0; loop < (nr_pages - 1); loop++, p++) {
> >> prefetchw(p + 1);
> >> - __ClearPageReserved(p);
> >> set_page_count(p, 0);
> >> }
> >> - __ClearPageReserved(p);
> >> set_page_count(p, 0);
> >
> >Is the prefetchw() still useful? Any remotely competent CPU should
> >be able to figure out this loop ...
>
> Hi, Matthew
>
> Thanks for your question. But to be honest, I am not fully understand it.
Let's try this question:
If you remove the prefetchw() line, does the performance change?
> Per my understanding, prefetchw() is trying to load data to cache before we
> really accessing it. By doing so, we won't hit a cache miss when we really
> need it.
Yes, but the CPU can also do this by itself without needing an explicit
hint from software. It can notice that we have a loop that's accessing
successive cachelines for write. This is approximately the easiest
prefetcher to design.
next prev parent reply other threads:[~2024-06-29 16:28 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-29 1:33 [PATCH 1/4] mm: use zonelist_zone() to get zone Wei Yang
2024-06-29 1:33 ` [PATCH 2/4] mm: not __SetPageReserved on initializing hot-plugged memory Wei Yang
2024-06-29 6:19 ` David Hildenbrand
2024-06-29 8:32 ` Wei Yang
2024-06-29 14:38 ` David Hildenbrand
2024-06-30 7:32 ` Wei Yang
2024-06-29 1:33 ` [PATCH 3/4] mm/page_alloc: put __free_pages_core() in __meminit section Wei Yang
2024-06-29 1:33 ` [PATCH 4/4] mm/page_alloc: no need to ClearPageReserved on giving page to buddy system Wei Yang
2024-06-29 3:21 ` Matthew Wilcox
2024-06-29 8:44 ` Wei Yang
2024-06-29 16:28 ` Matthew Wilcox [this message]
2024-06-29 16:45 ` Matthew Wilcox
2024-06-30 7:30 ` Wei Yang
[not found] ` <4a93f7b7-8ba8-4877-99c7-1048674d074d@redhat.com>
[not found] ` <299a4d6a-6b76-49b7-be2e-573cd66fd46f@redhat.com>
2024-06-29 8:48 ` Wei Yang
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=ZoA2MmX5FMG58PCP@casper.infradead.org \
--to=willy@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=david@redhat.com \
--cc=linux-mm@kvack.org \
--cc=richard.weiyang@gmail.com \
--cc=rppt@kernel.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;
as well as URLs for NNTP newsgroup(s).