From: akash.tyagi <akash.tyagi@mediatek.com>
To: <ziy@nvidia.com>, <david@redhat.com>, <surenb@google.com>
Cc: <akash.tyagi@mediatek.com>, <akpm@linux-foundation.org>,
<vbabka@suse.cz>, <matthias.bgg@gmail.com>,
<angelogioacchino.delregno@collabora.com>, <mhocko@suse.com>,
<jackmanb@google.com>, <hannes@cmpxchg.org>, <linux-mm@kvack.org>,
<linux-kernel@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-mediatek@lists.infradead.org>, <wsd_upstream@mediatek.com>,
<chinwen.chang@mediatek.com>
Subject: Re: [RFC PATCH] mm/page_alloc: Add PCP list for THP CMA
Date: Tue, 29 Jul 2025 18:00:28 +0530 [thread overview]
Message-ID: <20250729123028.1224786-1-akash.tyagi@mediatek.com> (raw)
In-Reply-To: <E70C1648-DDAB-4027-AB07-1C19B10C6AEF@nvidia.com>
On Fri, 25 Jul 2025 at 10:27, Zi Yan <ziy@nvidia.com> wrote:
> But there is this known problem that CMA can fail temporarily due to
> short-term pinnings. See the "reliable CMA" work (don't remember the exact name).
> I think you mean Guaranteed CMA[1].
>
> [1] https://lore.kernel.org/linux-mm/CAJuCfpEWVEqsivd7oTvp4foEho_HaD1XNP8KTeKWzG_X2skfGQ@mail.gmail.com/
>
> Best Regards,
> Yan, Zi
Hi,
Yes, the issue I described is actually related to Guaranteed CMA[1].
I have rewritten our problem statement to address concerns more specifically related to the Android common kernels.
Problem statement:
Android Common kernels usually have an out-of-tree patch to prevent file-backed page allocated from CMA.
It allows some allocations which have lower chance of being pinned to use CMA to improve CMA utilization controlled by a flag __GFP_CMA.
https://lore.kernel.org/lkml/cover.1604282969.git.cgoldswo@codeaurora.org/
Additionally, android kernels create cma pcp list for pages less than PAGE_ALLOC_COSTLY_ORDER, but not for THP pages.
This way we noticed some UNMOVABLE allocation also occured from CMA via pcplist as for THP there is pcp either for movable or UNMOVABLE/RECLAIMABLE but not for CMA.
so we moved CMA pages to movable for THP.
movable = migratetype == MIGRATE_MOVABLE;
#ifdef CONFIG_CMA
movable |= migratetype == MIGRATE_CMA;
#endif
return NR_LOWORDER_PCP_LISTS + movable;
Now, this way we fixes the issue where CMA pages wrongly placed in UNMOVABLE PCP.
But now if there is a GFP_MOVABLE allocation (even without __GFP_CMA) (which android kernel maintains out-of-tree patch as share above), might pull that CMA page from the PCP.
This breaks the intended use case of the above patch, which is to allow only allocations that use the __GFP_CMA flag.
To address this, we have proposed introducing a CMA PCP for THP pages as well.
I would appreciate your review and feedback on whether this is a feasible approach for adding a new PCP in Android common kernel perspective becuase Because having many MIGRATE_CMA pages
in the THP lists could cause several performance issues.
Best Regards,
Akash Tyagi
next prev parent reply other threads:[~2025-07-29 12:38 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-24 7:53 akash.tyagi
2025-07-24 9:52 ` David Hildenbrand
2025-07-25 5:08 ` akash.tyagi
2025-07-25 7:04 ` David Hildenbrand
2025-07-25 14:27 ` Zi Yan
2025-07-29 12:30 ` akash.tyagi [this message]
2025-07-29 12:42 ` David Hildenbrand
2025-07-29 12:50 ` Matthew Wilcox
2025-08-04 18:31 ` Juan Yescas
2025-08-04 18:20 Juan Yescas
2025-08-04 18:49 ` David Hildenbrand
2025-08-04 19:00 ` Zi Yan
2025-08-04 19:10 ` David Hildenbrand
2025-08-05 1:24 ` Juan Yescas
2025-08-05 1:22 ` Juan Yescas
2025-08-05 9:54 ` Vlastimil Babka
2025-08-05 16:46 ` Juan Yescas
2025-08-05 17:12 ` Juan Yescas
2025-08-05 21:09 ` Vlastimil Babka
2025-08-06 21:54 ` Juan Yescas
2025-08-05 9:58 ` David Hildenbrand
2025-08-05 16:57 ` Juan Yescas
2025-08-05 21:08 ` David Hildenbrand
2025-08-06 21:44 ` Juan Yescas
2025-08-06 21:51 ` Juan Yescas
2025-09-09 20:07 ` Juan Yescas
2025-09-09 20:11 ` Juan Yescas
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=20250729123028.1224786-1-akash.tyagi@mediatek.com \
--to=akash.tyagi@mediatek.com \
--cc=akpm@linux-foundation.org \
--cc=angelogioacchino.delregno@collabora.com \
--cc=chinwen.chang@mediatek.com \
--cc=david@redhat.com \
--cc=hannes@cmpxchg.org \
--cc=jackmanb@google.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-mm@kvack.org \
--cc=matthias.bgg@gmail.com \
--cc=mhocko@suse.com \
--cc=surenb@google.com \
--cc=vbabka@suse.cz \
--cc=wsd_upstream@mediatek.com \
--cc=ziy@nvidia.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