[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aJpHE0hyaRw8Reig@hyeyoo>
Date: Tue, 12 Aug 2025 04:40:03 +0900
From: Harry Yoo <harry.yoo@...cle.com>
To: Jialin Wang <wjl.linux@...il.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Johannes Weiner <hannes@...xchg.org>,
David Hildenbrand <david@...hat.com>, Michal Hocko <mhocko@...nel.org>,
Qi Zheng <zhengqi.arch@...edance.com>,
Shakeel Butt <shakeel.butt@...ux.dev>,
Lorenzo Stoakes <lorenzo.stoakes@...cle.com>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH RESEND] mm/vmscan: remove redundant
folio_test_swapbacked()
On Tue, Aug 12, 2025 at 03:21:12AM +0800, Jialin Wang wrote:
> On Tue, Aug 12, 2025 at 2:53 AM Harry Yoo <harry.yoo@...cle.com> wrote:
> >
> > This is marked as RESEND, but which patch is it a resend of?
> > I can’t find the original one.
> >
> I sent the original one to the wrong mailing list and missed proper cc's, sorry.
> https://lore.kernel.org/lkml/20250811181839.40336-1-wjl.linux@gmail.com/
Ahh I see. I couldn't find it because it was not sent to linux-mm.
I assumed you sent it a while ago but didn't get any feedback.
> > On Tue, Aug 12, 2025 at 02:25:00AM +0800, Jialin Wang wrote:
> > > When !folio_is_file_lru(folio) is false, it implies that
> > > !folio_test_swapbacked(folio) must be true.
> >
> > That is not true.
Oops, I completely misread the message and really sorry for that.
I thought you're saying "anonymous pages are always swapbacked",
(without considering ! in the expression), but you weren't saying that.
Probably I shouldn't have read it so late at night ;)
> This is the definition of folio_is_file_lru() in
> include/linux/mm_inline.h line 28:
> static inline int folio_is_file_lru(struct folio *folio)
> {
> return !folio_test_swapbacked(folio);
> }
You're right that technically this can be simplified, but I see Miaohe
tried this exactly same simplication a few years ago and it got some
negative feedbacks from people as it makes it harder to read the code.
https://lore.kernel.org/linux-mm/87lewqbpad.fsf@yhuang6-desk2.ccr.corp.intel.com
So maybe not worth it?
> > MADV_FREE pages are anonymous pages that are not swapbacked
> > (and thus can be reclaimed without pageout if they are clean).
> >
> Thanks for the explanation! I'm new to memory management, so this is
> really helpful for me to learn.
You're welcome!
> Best regards,
> Jialin Wang
--
Cheers,
Harry / Hyeonggon
Powered by blists - more mailing lists