From: Svetly Todorov <svetly.todorov@memverge.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
gregory.price@memverge.com, wangkefeng.wang@huawei.com,
akpm@linux-foundation.org, david@redhat.com, vbabka@suse.cz,
naoya.horiguchi@linux.dev
Subject: Re: [PATCH v3] kpageflags: respect folio head-page flag placement
Date: Wed, 20 Mar 2024 16:40:43 -0700 [thread overview]
Message-ID: <c1425f97-0d9b-441e-a06b-ea00d75a2e73@memverge.com> (raw)
In-Reply-To: <Zfs33TNtHvnjDX3J@casper.infradead.org>
Hi Matthew,
> I have a somewhat different patch for this. Let me know what you think.
> It depends on a few other patches in my tree, so probably won't compile
> for you.
I don't have extensive experience with folios or anything but on the
whole it looks good to me. I like the use of `mapping` to dodge the
compound_head() checks. Beyond that, only a few things caught my eye.
> - if (PageKsm(page))
> + if (mapping & PAGE_MAPPING_KSM)
> u |= 1 << KPF_KSM;
This might need an #ifdef?
Say mapping is movable and anon -- then (mapping & PAGE_MAPPING_KSM) is
true. Before, we called PageKsm, which falls through to a PG_ksm check.
If !CONFIG_KSM then that flag is always false. But now, we're liable to
report KPF_KSM even if !CONFIG_KSM.
> /*
> * compound pages: export both head/tail info
> * they together define a compound page's start/end pos and order
> */
> - if (PageHead(page))
> - u |= 1 << KPF_COMPOUND_HEAD;
> - if (PageTail(page))
> + if (page == &folio->page)
> + u |= kpf_copy_bit(k, KPF_COMPOUND_HEAD, PG_head);
> + else
> u |= 1 << KPF_COMPOUND_TAIL;
This makes sense but it'd require changes to the documentation.
I ran a python3 memhog to see if anonymous pages are currently reported
as COMPOUND_HEAD or COMPOUND_TAIL and it seems to be a no on both.
But with this, I think every pfn will have one of the two set.
Unless you can have a page outside of a folio -- not sure.
Also, in
> - if (page_is_idle(page))
> +#if defined(CONFIG_PAGE_IDLE_FLAG) && defined(CONFIG_64BIT)
> + u |= kpf_copy_bit(k, KPF_IDLE, PG_idle);
> +#else
> + if (folio_test_idle(folio))
> u |= 1 << KPF_IDLE;
> +#endif
>
and
> - if (PageSwapCache(page))
> +#define SWAPCACHE ((1 << PG_swapbacked) | (1 << PG_swapcache))
> + if ((k & SWAPCACHE) == SWAPCACHE)
> u |= 1 << KPF_SWAPCACHE;
> u |= kpf_copy_bit(k, KPF_SWAPBACKED, PG_swapbacked);
it seems to me like the #ifdef/#define could be supplanted by
folio_test_idle and folio_test_swapcache. But I guess those would
require extra folio_flags queries and an #include <page_idle.h>.
So if this is more performant, I can understand the design.
Best,
Svetly
next prev parent reply other threads:[~2024-03-20 23:40 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-20 17:28 Svetly Todorov
2024-03-20 19:24 ` Matthew Wilcox
2024-03-20 23:40 ` Svetly Todorov [this message]
2024-03-21 16:03 ` Matthew Wilcox
2024-03-21 19:08 ` Svetly Todorov
2024-03-21 19:59 ` Matthew Wilcox
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=c1425f97-0d9b-441e-a06b-ea00d75a2e73@memverge.com \
--to=svetly.todorov@memverge.com \
--cc=akpm@linux-foundation.org \
--cc=david@redhat.com \
--cc=gregory.price@memverge.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=naoya.horiguchi@linux.dev \
--cc=vbabka@suse.cz \
--cc=wangkefeng.wang@huawei.com \
--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