[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ae19e5ef-82d5-44e1-96fe-18a2a16faac1@arm.com>
Date: Tue, 17 Dec 2024 07:09:39 +0000
From: Ryan Roberts <ryan.roberts@....com>
To: Matthew Wilcox <willy@...radead.org>, Dev Jain <dev.jain@....com>
Cc: akpm@...ux-foundation.org, david@...hat.com,
kirill.shutemov@...ux.intel.com, anshuman.khandual@....com,
catalin.marinas@....com, cl@...two.org, vbabka@...e.cz, mhocko@...e.com,
apopple@...dia.com, dave.hansen@...ux.intel.com, will@...nel.org,
baohua@...nel.org, jack@...e.cz, srivatsa@...il.mit.edu,
haowenchao22@...il.com, hughd@...gle.com, aneesh.kumar@...nel.org,
yang@...amperecomputing.com, peterx@...hat.com, ioworker0@...il.com,
wangkefeng.wang@...wei.com, ziy@...dia.com, jglisse@...gle.com,
surenb@...gle.com, vishal.moola@...il.com, zokeefe@...gle.com,
zhengqi.arch@...edance.com, jhubbard@...dia.com, 21cnbao@...il.com,
linux-mm@...ck.org, linux-kernel@...r.kernel.org
Subject: Re: [RFC PATCH 02/12] khugepaged: Generalize alloc_charge_folio()
On 17/12/2024 04:17, Matthew Wilcox wrote:
> On Mon, Dec 16, 2024 at 10:20:55PM +0530, Dev Jain wrote:
>> static int alloc_charge_folio(struct folio **foliop, struct mm_struct *mm,
>> - struct collapse_control *cc)
>> + int order, struct collapse_control *cc)
>
> unsigned, surely?
I'm obviously feeling argumentative this morning...
There are plenty of examples of order being signed and unsigned in the code
base... it's a mess. Certainly the mTHP changes up to now have opted for
(signed) int. And get_order(), which I would assume to the authority, returns
(signed) int.
Personally I prefer int for small positive integers; it's more compact. But if
we're trying to establish a pattern to use unsigned int for all new uses of
order, that fine too, let's just document it somewhere?
>
>> if (!folio) {
>> *foliop = NULL;
>> count_vm_event(THP_COLLAPSE_ALLOC_FAILED);
>> + if (order != HPAGE_PMD_ORDER)
>> + count_mthp_stat(order, MTHP_STAT_ANON_COLLAPSE_ALLOC_FAILED);
>
> i don't understand why we need new statistics here. we already have a
> signal that memory allocation failures are preventing collapse from
> being successful, why do we care if it's mthp or actual thp?
We previously decided that all existing THP stats would continue to only count
PMD-sized THP for fear of breaking userspace in subtle ways, and instead would
introduce new mTHP stats that can count for each order. We already have
MTHP_STAT_ANON_FAULT_ALLOC and MTHP_STAT_ANON_FAULT_FALLBACK (amongst others) so
these new stats fit the pattern well, IMHO.
(except for the bug that I called out in the other mail; we should call
count_mthp_stat() for all orders and call count_vm_event() only for PMD_ORDER).
>
>> count_vm_event(THP_COLLAPSE_ALLOC);
>> + if (order != HPAGE_PMD_ORDER)
>> + count_mthp_stat(order, MTHP_STAT_ANON_COLLAPSE_ALLOC);
>
> similar question
>
Powered by blists - more mailing lists