From: David Hildenbrand <david@redhat.com>
To: "Matthew Wilcox (Oracle)" <willy@infradead.org>,
Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm@kvack.org, Alex Shi <alexs@kernel.org>
Subject: Re: [PATCH 4/5] mm: Add PageAnonNotKsm()
Date: Mon, 7 Oct 2024 11:46:44 +0200 [thread overview]
Message-ID: <b45c927b-b0dd-48f7-81e8-77b25cd4d7aa@redhat.com> (raw)
In-Reply-To: <20241002152533.1350629-5-willy@infradead.org>
On 02.10.24 17:25, Matthew Wilcox (Oracle) wrote:
> Check that this anonymous page is really anonymous, not
> anonymous-or-KSM. This optimises the debug check, but its real purpose
> is to remove the last two users of PageKsm().
>
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> ---
> include/linux/page-flags.h | 11 +++++++++--
> 1 file changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
> index 4c2dfe289046..157c4ffc2fdc 100644
> --- a/include/linux/page-flags.h
> +++ b/include/linux/page-flags.h
> @@ -689,6 +689,13 @@ static __always_inline bool folio_test_anon(const struct folio *folio)
> return ((unsigned long)folio->mapping & PAGE_MAPPING_ANON) != 0;
> }
>
> +static __always_inline bool PageAnonNotKsm(const struct page *page)
> +{
> + unsigned long flags = (unsigned long)page_folio(page)->mapping;
> +
> + return (flags & PAGE_MAPPING_FLAGS) == PAGE_MAPPING_ANON;
> +}
> +
> static __always_inline bool PageAnon(const struct page *page)
> {
> return folio_test_anon(page_folio(page));
> @@ -1129,14 +1136,14 @@ static __always_inline int PageAnonExclusive(const struct page *page)
>
> static __always_inline void SetPageAnonExclusive(struct page *page)
> {
> - VM_BUG_ON_PGFLAGS(!PageAnon(page) || PageKsm(page), page);
> + VM_BUG_ON_PGFLAGS(PageAnonNotKsm(page), page);
> VM_BUG_ON_PGFLAGS(PageHuge(page) && !PageHead(page), page);
> set_bit(PG_anon_exclusive, &PF_ANY(page, 1)->flags);
> }
>
> static __always_inline void ClearPageAnonExclusive(struct page *page)
> {
> - VM_BUG_ON_PGFLAGS(!PageAnon(page) || PageKsm(page), page);
> + VM_BUG_ON_PGFLAGS(PageAnonNotKsm(page), page);
> VM_BUG_ON_PGFLAGS(PageHuge(page) && !PageHead(page), page);
> clear_bit(PG_anon_exclusive, &PF_ANY(page, 1)->flags);
> }
With the "!" added in both cases
Acked-by: David Hildenbrand <david@redhat.com>
--
Cheers,
David / dhildenb
next prev parent reply other threads:[~2024-10-07 9:46 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-02 15:25 [PATCH 0/5] Remove PageKsm() Matthew Wilcox (Oracle)
2024-10-02 15:25 ` [PATCH 1/5] ksm: Use a folio in try_to_merge_one_page() Matthew Wilcox (Oracle)
2024-10-07 9:43 ` David Hildenbrand
2024-10-02 15:25 ` [PATCH 2/5] ksm: Convert cmp_and_merge_page() to use a folio Matthew Wilcox (Oracle)
2024-10-07 9:44 ` David Hildenbrand
2024-10-02 15:25 ` [PATCH 3/5] ksm: Convert should_skip_rmap_item() to take " Matthew Wilcox (Oracle)
2024-10-07 9:46 ` David Hildenbrand
2024-10-02 15:25 ` [PATCH 4/5] mm: Add PageAnonNotKsm() Matthew Wilcox (Oracle)
[not found] ` <CGME20241004114615eucas1p1910b6b4e74f8a878f56104026eece731@eucas1p1.samsung.com>
2024-10-04 11:46 ` Marek Szyprowski
2024-10-06 14:11 ` kernel test robot
2024-10-07 9:46 ` David Hildenbrand [this message]
2024-10-02 15:25 ` [PATCH 5/5] mm: Remove PageKsm() Matthew Wilcox (Oracle)
2024-10-07 9:47 ` 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=b45c927b-b0dd-48f7-81e8-77b25cd4d7aa@redhat.com \
--to=david@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=alexs@kernel.org \
--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