From: Linus Torvalds <torvalds@linux-foundation.org>
To: Andrew Morton <akpm@linux-foundation.org>,
David Howells <dhowells@redhat.com>,
Stephen Rothwell <sfr@canb.auug.org.au>
Cc: linux-mm@kvack.org, mm-commits@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [GIT PULL] MM updates for 6.5-rc1
Date: Wed, 28 Jun 2023 11:19:56 -0700 [thread overview]
Message-ID: <CAHk-=wie=MvQzmjhKGCCbRapK3Zz-b8GFUchEDJi7SkeLAX6Pw@mail.gmail.com> (raw)
In-Reply-To: <CAHk-=wjyJyV=Kyb8XJcLjFEPP-RMF0J6CQfT2OXLmJdM2yEv8w@mail.gmail.com>
On Wed, 28 Jun 2023 at 10:27, Linus Torvalds
<torvalds@linux-foundation.org> wrote:
>
> So I think it needs to match the comment (and the try_grab_page()
> logic), and just basically
>
> if (flags & FOLL_GET)
> return try_get_folio(page, refs);
>
> if (is_zero_page(page))
> return page_folio(page);
>
> folio = try_get_folio(page, refs);
> if (!folio)
> return NULL;
>
> instead.
Side note: I think we should just do the "FOLL_GET" doesn't touch the
refcount either, which would make this all become just
if (is_zero_page(page))
return page_folio(page);
folio = try_get_folio(page, refs);
if (!folio)
return NULL;
but then we would need to fix try_grab_page() and gup_put_folio() and
friends to match. And any other cases I haven't thought of.
Long long ago we used to have the logic that PG_reserved meant that no
refcounting was done, and that automatically handled the zero page(s).
But that was removed back in 2005... That old commit even talks about
this issue:
A last caveat: the ZERO_PAGE is now refcounted and managed with rmap (and
thus mapcounted and count towards shared rss). These writes to the struct
page could cause excessive cacheline bouncing on big systems. There are a
number of ways this could be addressed if it is an issue.
It's commit b5810039a54e ("[PATCH] core remove PageReserved") in case
anybody wants to do some historical archaeology.
Linus
next prev parent reply other threads:[~2023-06-28 18:20 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-26 15:50 Andrew Morton
2023-06-28 17:27 ` Linus Torvalds
2023-06-28 18:19 ` Linus Torvalds [this message]
2023-06-28 19:18 ` David Howells
2023-06-28 18:49 ` pr-tracker-bot
2023-06-28 19:10 ` David Howells
2023-06-28 19:19 ` Linus Torvalds
2023-06-28 19:50 ` Lorenzo Stoakes
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='CAHk-=wie=MvQzmjhKGCCbRapK3Zz-b8GFUchEDJi7SkeLAX6Pw@mail.gmail.com' \
--to=torvalds@linux-foundation.org \
--cc=akpm@linux-foundation.org \
--cc=dhowells@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mm-commits@vger.kernel.org \
--cc=sfr@canb.auug.org.au \
/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