From: Kefeng Wang <wangkefeng.wang@huawei.com>
To: Gregory Price <gregory.price@memverge.com>
Cc: Matthew Wilcox <willy@infradead.org>,
Gregory Price <gourry.memverge@gmail.com>, <linux-mm@kvack.org>,
<akpm@linux-foundation.org>, <david@redhat.com>, <vbabka@suse.cz>,
<naoya.horiguchi@linux.dev>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] kpageflags: respect folio head-page flag placement
Date: Wed, 8 Nov 2023 10:01:19 +0800 [thread overview]
Message-ID: <cc4ac7de-97f5-4131-804d-622fb158dba9@huawei.com> (raw)
In-Reply-To: <ZUpZCsR1rmIau8wv@memverge.com>
On 2023/11/7 23:34, Gregory Price wrote:
> On Tue, Nov 07, 2023 at 09:03:53AM +0800, Kefeng Wang wrote:
>>
>>
>> On 2023/10/31 12:34, Gregory Price wrote:
>>> On Tue, Oct 31, 2023 at 09:13:44AM +0000, Matthew Wilcox wrote:
>>>> On Mon, Oct 30, 2023 at 07:41:23PM -0400, Gregory Price wrote:
>>>>> On Mon, Oct 30, 2023 at 11:22:18PM +0000, Matthew Wilcox wrote:
>>>>>> On Mon, Oct 30, 2023 at 02:00:05PM -0400, Gregory Price wrote:
>>>>>>> kpageflags reads page-flags directly from the page, even when the
>>>>>>> respective flag is only updated on the headpage of a folio.
>>>>>>>
>>>>>>> Update bitchecks to use PAGEFLAG() interfaces to check folio for the
>>>>>>> referenced, dirty, lru, active, and unevictable bits.
>>>>>>
>>>>>> But uptodate, writeback and reclaim (amongst others) are also defined
>>>>>> only on the head page.
>>>>>>
>>>>>
>>>>> Ah yes i was only looking at the things defined w/ PAGEFLAG defines in
>>>>> page-flags.h. I'll give it full once over can collect them all, my bad.
>>>>>
>>>>> (also i forgot to update my commit message)
>>>>>
>>>>> Quick question here since i have your attention: any recommendation on
>>>>> what to do for ONLY_HEAD flags? If the provided page is not the head,
>>>>> should the flag report 0... or whatever the head says?
>>>>
>>>> Thinking about it some more, really almost all flags are per-folio, not
>>>> per-page. The only exceptions are HWPoison and AnonExclusive. So
>>>> probably the right way to do this is to make k = folio->flags, and
>>>> then just change a few places rather than changing all the places that
>>>> test 'k'.
>>>
>>> Funny enough that's what i originally did but was confident it was
>>> correct so walked it back. I'll take another crack at it.
>>
>> Hi Gregory, any update?
>> I changed stable_page_flags[1] when try to remove page idle wrapper,
>> Matthew pointed it will conflict with this, I could redo my patch
>> based on your new version:)
>>
>> [1]https://lore.kernel.org/linux-mm/20231103072906.2000381-5-wangkefeng.wang@huawei.com/
>>
>> Thanks.
>
> looks like we were noticing the same thing. I haven't done any further
> work, got caught up in another project.
Yes, I see your "Node Weights and Weighted Interleave", this is an
interesting topic, we need some easy and efficient way to use tiered
memory.
>
> Matthew last pointed out:
>
> "probably the right way to do this is to make k = folio->flags, and then
> just change a few places rather than changing all the places that test
> 'k'."
>
> https://lore.kernel.org/linux-mm/ZUDFSEvpxxoGWmdG@casper.infradead.org/
>
> I took a quick look, and the only thing I'm not confident about is that
> some flags are stored in the head page, and some are stored on the
> second page.
>
> /* Which page is the flag stored in */
> #define FOLIO_PF_ANY 0
> #define FOLIO_PF_HEAD 0
> #define FOLIO_PF_ONLY_HEAD 0
> #define FOLIO_PF_NO_TAIL 0
> #define FOLIO_PF_NO_COMPOUND 0
> #define FOLIO_PF_SECOND 1
>
> There's only a handful, so yeah the best way is probably to go ahead and
> swap k = page->flags for k = *folio_flags(folio, 0) and then handle the
> couple of outliars.
If you don't mind, I maybe try to convert it in my changes.
Thanks.
>
> ~Gregory
next prev parent reply other threads:[~2023-11-08 2:02 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-30 18:00 Gregory Price
2023-10-30 23:22 ` Matthew Wilcox
2023-10-30 23:41 ` Gregory Price
2023-10-31 9:13 ` Matthew Wilcox
2023-10-31 4:34 ` Gregory Price
2023-11-07 1:03 ` Kefeng Wang
2023-11-07 15:34 ` Gregory Price
2023-11-08 2:01 ` Kefeng Wang [this message]
2023-11-08 23:33 ` Gregory Price
2023-11-09 9:05 ` Kefeng Wang
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=cc4ac7de-97f5-4131-804d-622fb158dba9@huawei.com \
--to=wangkefeng.wang@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=david@redhat.com \
--cc=gourry.memverge@gmail.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=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