From: Matthew Wilcox <willy@infradead.org>
To: Donet Tom <donettom@linux.ibm.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Gregory Price <gourry@gourry.net>, Yu Zhao <yuzhao@google.com>,
Ritesh Harjani <ritesh.list@gmail.com>,
"Aneesh Kumar K . V" <aneesh.kumar@kernel.org>,
David Hildenbrand <david@redhat.com>,
Huang Ying <ying.huang@linux.alibaba.com>,
Johannes Weiner <hannes@cmpxchg.org>
Subject: Re: [RFC] mm/swap.c: Enable promotion of unmapped MGLRU page cache pages
Date: Thu, 16 Jan 2025 18:46:06 +0000 [thread overview]
Message-ID: <Z4lT7uYviShCbXt6@casper.infradead.org> (raw)
In-Reply-To: <7f370dd2-a1d2-4b35-ac40-0380633846fc@linux.ibm.com>
On Thu, Jan 16, 2025 at 04:40:21PM +0530, Donet Tom wrote:
> > Should there be an 'else' clause here? Or should it be:
> >
> > lruvec = mem_cgroup_lruvec(memcg, folio_pgdat(folio));
> > gen = folio_lru_gen(folio);
> > if ((gen < MAX_NR_GENS) && lru_gen_is_active(lruvec, gen))
> > promotion_candidate(folio);
> >
> Yes, there should be an else block to handle the promotion of non memcg
> folios.
>
> Does this approach look correct to you?
No. Look at the implementation of folio_memcg(), and
mem_cgroup_lruvec() for that matter.
> } while (!try_cmpxchg(&folio->flags, &old_flags, new_flags));
> +
> +promo_candid:
> + if (!folio_test_isolated(folio) &&
> + (sysctl_numa_balancing_mode & NUMA_BALANCING_MEMORY_TIERING)
> &&
> + numa_pagecache_promotion_enabled) {
> + pgdat = folio_pgdat(folio);
> + gen = folio_lru_gen(folio);
> +
> + if (mem_cgroup_disabled())
> + lruvec = &pgdat->__lruvec;
> + else {
> + memcg = folio_memcg(folio);
> + lruvec = mem_cgroup_lruvec(memcg, pgdat);
> + }
> +
> + if ((gen < MAX_NR_GENS) && lru_gen_is_active(lruvec, gen))
> + promotion_candidate(folio);
> + }
> }
>
>
next prev parent reply other threads:[~2025-01-16 18:46 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-15 12:06 [RFC] mm/swap.c: Enable promotion of unmapped MGLRU page cache pages Donet Tom
2025-01-15 13:25 ` Matthew Wilcox
2025-01-16 11:10 ` Donet Tom
2025-01-16 18:46 ` Matthew Wilcox [this message]
2025-01-15 16:09 ` Gregory Price
2025-01-16 11:16 ` Donet Tom
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=Z4lT7uYviShCbXt6@casper.infradead.org \
--to=willy@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=aneesh.kumar@kernel.org \
--cc=david@redhat.com \
--cc=donettom@linux.ibm.com \
--cc=gourry@gourry.net \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ritesh.list@gmail.com \
--cc=ying.huang@linux.alibaba.com \
--cc=yuzhao@google.com \
/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