From: Yang Shi <shy828301@gmail.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: linux-mm@kvack.org
Subject: Re: Can the huge zero page be partially mapped?
Date: Mon, 4 Mar 2024 11:19:36 -0800 [thread overview]
Message-ID: <CAHbLzkpjWvBDqFzz1hysnmQRMzEE9vc4fyQDO2CJX8Om6ZpBsA@mail.gmail.com> (raw)
In-Reply-To: <ZeX8tPqBTN8drESa@casper.infradead.org>
On Mon, Mar 4, 2024 at 8:54 AM Matthew Wilcox <willy@infradead.org> wrote:
>
> I looked at the definition of is_huge_zero_page():
>
> static inline bool is_huge_zero_page(struct page *page)
> {
> return READ_ONCE(huge_zero_page) == page;
> }
>
> That made me raise my eyebrows a bit because it will return false for
> tail pages of the HZP (that was at least unexpected for me). Then we
> have this beauty:
>
> void free_page_and_swap_cache(struct page *page)
> {
> struct folio *folio = page_folio(page);
>
> free_swap_cache(folio);
> if (!is_huge_zero_page(page))
> folio_put(folio);
> }
>
> So if we can call free_page_and_swap_cache() with a tail of the HZP
> we can absolutely screw up its refcounting. Now, we have VM_BUGs
> to catch the refcount going below 0, and I haven't seen them being
> hit, so I _presume_ it doesn't happen, but maybe somebody inventive
> could come up with a way of putting a HZP tail into a page table ...?
The huge zero pmd split is specially handled by
__split_huge_zero_page_pmd(), which actually replaces every subpages
of HZP to zero page.
>
next prev parent reply other threads:[~2024-03-04 19:19 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-04 16:54 Matthew Wilcox
2024-03-04 19:19 ` Yang Shi [this message]
2024-03-04 21:52 ` David Hildenbrand
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=CAHbLzkpjWvBDqFzz1hysnmQRMzEE9vc4fyQDO2CJX8Om6ZpBsA@mail.gmail.com \
--to=shy828301@gmail.com \
--cc=linux-mm@kvack.org \
--cc=willy@infradead.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