* [PATCH] mm/hugetlb: use account_new_hugetlb_folio() in add_hugetlb_folio()
@ 2026-10-27 6:04 Enze Li
2026-10-27 6:26 ` Muchun Song
2026-10-27 9:03 ` David Hildenbrand (Arm)
0 siblings, 2 replies; 5+ messages in thread
From: Enze Li @ 2026-10-27 6:04 UTC (permalink / raw)
To: muchun.song, osalvador, david, akpm; +Cc: linux-mm, Enze Li
Every other place that accounts a new huge page already calls
account_new_hugetlb_folio(), and add_hugetlb_folio() was the odd one
out, still open-coding the same two increments. Swap it over.
The helper is defined further down the file, so add a forward
declaration for it.
No functional change intended.
Signed-off-by: Enze Li <lienze@kylinos.cn>
---
mm/hugetlb.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 4a008afaedf9..a8d162449daa 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -142,6 +142,7 @@ static void hugetlb_unmap_range(struct mmu_gather *tlb,
unsigned long end, struct folio *folio,
zap_flags_t zap_flags);
static struct resv_map *vma_resv_map(struct vm_area_struct *vma);
+static void account_new_hugetlb_folio(struct hstate *h, struct folio *folio);
static inline bool subpool_is_free(struct hugepage_subpool *spool)
{
@@ -1444,8 +1445,7 @@ void add_hugetlb_folio(struct hstate *h, struct folio *folio,
lockdep_assert_held(&hugetlb_lock);
INIT_LIST_HEAD(&folio->lru);
- h->nr_huge_pages++;
- h->nr_huge_pages_node[nid]++;
+ account_new_hugetlb_folio(h, folio);
if (adjust_surplus) {
h->surplus_huge_pages++;
base-commit: bae9a042b03b27924c6fd5bdc00a20d6a44d6041
--
2.56.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH] mm/hugetlb: use account_new_hugetlb_folio() in add_hugetlb_folio()
2026-10-27 6:04 [PATCH] mm/hugetlb: use account_new_hugetlb_folio() in add_hugetlb_folio() Enze Li
@ 2026-10-27 6:26 ` Muchun Song
2026-10-27 9:03 ` David Hildenbrand (Arm)
1 sibling, 0 replies; 5+ messages in thread
From: Muchun Song @ 2026-10-27 6:26 UTC (permalink / raw)
To: Enze Li; +Cc: osalvador, david, akpm, linux-mm
> On Oct 27, 2026, at 14:04, Enze Li <lienze@kylinos.cn> wrote:
>
> Every other place that accounts a new huge page already calls
> account_new_hugetlb_folio(), and add_hugetlb_folio() was the odd one
> out, still open-coding the same two increments. Swap it over.
>
> The helper is defined further down the file, so add a forward
> declaration for it.
>
> No functional change intended.
>
> Signed-off-by: Enze Li <lienze@kylinos.cn>
Reviewed-by: Muchun Song <muchun.song@linux.dev>
Thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mm/hugetlb: use account_new_hugetlb_folio() in add_hugetlb_folio()
2026-10-27 6:04 [PATCH] mm/hugetlb: use account_new_hugetlb_folio() in add_hugetlb_folio() Enze Li
2026-10-27 6:26 ` Muchun Song
@ 2026-10-27 9:03 ` David Hildenbrand (Arm)
2026-10-27 10:01 ` Enze Li
1 sibling, 1 reply; 5+ messages in thread
From: David Hildenbrand (Arm) @ 2026-10-27 9:03 UTC (permalink / raw)
To: Enze Li, muchun.song, osalvador, akpm; +Cc: linux-mm
On 10/27/26 07:04, Enze Li wrote:
> Every other place that accounts a new huge page already calls
> account_new_hugetlb_folio(), and add_hugetlb_folio() was the odd one
> out, still open-coding the same two increments. Swap it over.
>
> The helper is defined further down the file, so add a forward
> declaration for it.
>
> No functional change intended.
>
> Signed-off-by: Enze Li <lienze@kylinos.cn>
> ---
> mm/hugetlb.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index 4a008afaedf9..a8d162449daa 100644
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -142,6 +142,7 @@ static void hugetlb_unmap_range(struct mmu_gather *tlb,
> unsigned long end, struct folio *folio,
> zap_flags_t zap_flags);
> static struct resv_map *vma_resv_map(struct vm_area_struct *vma);
> +static void account_new_hugetlb_folio(struct hstate *h, struct folio *folio);
>
> static inline bool subpool_is_free(struct hugepage_subpool *spool)
> {
> @@ -1444,8 +1445,7 @@ void add_hugetlb_folio(struct hstate *h, struct folio *folio,
> lockdep_assert_held(&hugetlb_lock);
>
> INIT_LIST_HEAD(&folio->lru);
> - h->nr_huge_pages++;
> - h->nr_huge_pages_node[nid]++;
> + account_new_hugetlb_folio(h, folio);
>
> if (adjust_surplus) {
> h->surplus_huge_pages++;
>
> base-commit: bae9a042b03b27924c6fd5bdc00a20d6a44d6041
I have a fix in that area planned. So let's revisit that in a couple of weeks.
--
Cheers,
David
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] mm/hugetlb: use account_new_hugetlb_folio() in add_hugetlb_folio()
2026-10-27 9:03 ` David Hildenbrand (Arm)
@ 2026-10-27 10:01 ` Enze Li
2026-10-27 10:49 ` David Hildenbrand (Arm)
0 siblings, 1 reply; 5+ messages in thread
From: Enze Li @ 2026-10-27 10:01 UTC (permalink / raw)
To: David Hildenbrand (Arm); +Cc: linux-mm, muchun.song, osalvador, akpm
On 10/27/26 5:03 PM, David Hildenbrand (Arm) wrote:
> On 10/27/26 07:04, Enze Li wrote:
>> Every other place that accounts a new huge page already calls
>> account_new_hugetlb_folio(), and add_hugetlb_folio() was the odd one
>> out, still open-coding the same two increments. Swap it over.
>>
>> The helper is defined further down the file, so add a forward
>> declaration for it.
>>
>> No functional change intended.
>>
>> Signed-off-by: Enze Li <lienze@kylinos.cn>
>> ---
>> mm/hugetlb.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
>> index 4a008afaedf9..a8d162449daa 100644
>> --- a/mm/hugetlb.c
>> +++ b/mm/hugetlb.c
>> @@ -142,6 +142,7 @@ static void hugetlb_unmap_range(struct mmu_gather *tlb,
>> unsigned long end, struct folio *folio,
>> zap_flags_t zap_flags);
>> static struct resv_map *vma_resv_map(struct vm_area_struct *vma);
>> +static void account_new_hugetlb_folio(struct hstate *h, struct folio *folio);
>>
>> static inline bool subpool_is_free(struct hugepage_subpool *spool)
>> {
>> @@ -1444,8 +1445,7 @@ void add_hugetlb_folio(struct hstate *h, struct folio *folio,
>> lockdep_assert_held(&hugetlb_lock);
>>
>> INIT_LIST_HEAD(&folio->lru);
>> - h->nr_huge_pages++;
>> - h->nr_huge_pages_node[nid]++;
>> + account_new_hugetlb_folio(h, folio);
>>
>> if (adjust_surplus) {
>> h->surplus_huge_pages++;
>>
>> base-commit: bae9a042b03b27924c6fd5bdc00a20d6a44d6041
>
> I have a fix in that area planned. So let's revisit that in a couple of weeks.
>
Thanks for the heads-up. I'll hold off on this one and resend in a
couple of weeks once your changes land, if it's still needed.
Best regards,
Enze
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] mm/hugetlb: use account_new_hugetlb_folio() in add_hugetlb_folio()
2026-10-27 10:01 ` Enze Li
@ 2026-10-27 10:49 ` David Hildenbrand (Arm)
0 siblings, 0 replies; 5+ messages in thread
From: David Hildenbrand (Arm) @ 2026-10-27 10:49 UTC (permalink / raw)
To: Enze Li; +Cc: linux-mm, muchun.song, osalvador, akpm
On 10/27/26 11:01, Enze Li wrote:
>
>
> On 10/27/26 5:03 PM, David Hildenbrand (Arm) wrote:
>> On 10/27/26 07:04, Enze Li wrote:
>>> Every other place that accounts a new huge page already calls
>>> account_new_hugetlb_folio(), and add_hugetlb_folio() was the odd one
>>> out, still open-coding the same two increments. Swap it over.
>>>
>>> The helper is defined further down the file, so add a forward
>>> declaration for it.
>>>
>>> No functional change intended.
>>>
>>> Signed-off-by: Enze Li <lienze@kylinos.cn>
>>> ---
>>> mm/hugetlb.c | 4 ++--
>>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
>>> index 4a008afaedf9..a8d162449daa 100644
>>> --- a/mm/hugetlb.c
>>> +++ b/mm/hugetlb.c
>>> @@ -142,6 +142,7 @@ static void hugetlb_unmap_range(struct mmu_gather *tlb,
>>> unsigned long end, struct folio *folio,
>>> zap_flags_t zap_flags);
>>> static struct resv_map *vma_resv_map(struct vm_area_struct *vma);
>>> +static void account_new_hugetlb_folio(struct hstate *h, struct folio *folio);
>>>
>>> static inline bool subpool_is_free(struct hugepage_subpool *spool)
>>> {
>>> @@ -1444,8 +1445,7 @@ void add_hugetlb_folio(struct hstate *h, struct folio *folio,
>>> lockdep_assert_held(&hugetlb_lock);
>>>
>>> INIT_LIST_HEAD(&folio->lru);
>>> - h->nr_huge_pages++;
>>> - h->nr_huge_pages_node[nid]++;
>>> + account_new_hugetlb_folio(h, folio);
>>>
>>> if (adjust_surplus) {
>>> h->surplus_huge_pages++;
>>>
>>> base-commit: bae9a042b03b27924c6fd5bdc00a20d6a44d6041
>>
>> I have a fix in that area planned. So let's revisit that in a couple of weeks.
>>
>
> Thanks for the heads-up. I'll hold off on this one and resend in a
> couple of weeks once your changes land, if it's still needed.
Thanks. In general, try avoiding things that are not fixes during the merge
window as we try to focus on fixing things (right now more than ever).
--
Cheers,
David
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-10-27 10:49 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-27 6:04 [PATCH] mm/hugetlb: use account_new_hugetlb_folio() in add_hugetlb_folio() Enze Li
2026-10-27 6:26 ` Muchun Song
2026-10-27 9:03 ` David Hildenbrand (Arm)
2026-10-27 10:01 ` Enze Li
2026-10-27 10:49 ` David Hildenbrand (Arm)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox