[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3f7ba97d-04d5-4ea4-9f08-6ec3584e0d4c@redhat.com>
Date: Thu, 8 May 2025 19:39:42 +0200
From: David Hildenbrand <david@...hat.com>
To: Usama Arif <usamaarif642@...il.com>,
Andrew Morton <akpm@...ux-foundation.org>, linux-mm@...ck.org
Cc: hannes@...xchg.org, shakeel.butt@...ux.dev, riel@...riel.com,
ziy@...dia.com, baolin.wang@...ux.alibaba.com, lorenzo.stoakes@...cle.com,
Liam.Howlett@...cle.com, npache@...hat.com, ryan.roberts@....com,
linux-kernel@...r.kernel.org, kernel-team@...a.com
Subject: Re: [PATCH 0/1] prctl: allow overriding system THP policy to always
>> We did something similar with PR_SET_MEMORY_MERGE.
>>
>
> For this you mean the prctl command would do for_each_vma and set VM_HUGEPAGE to implement point 2.
Yes. The expectation would be that the prctl is either a) triggered
early when there are not that many VMAs yet or b) inherited during
fork+exec such that the target process immediately gets it enabled for
all VMAs.
> For having point 1, I think we will still need extra mm->flags, i.e. MMF_VM_THP_MADVISE/DEFER/ALWAYS/NEVER.
Yes, and it's unclear what we really want here.
>
> I think it would have the same affect as what this patch is trying to do? But would be just more
> expensive in terms of both code changes and the cost of the actual call as you now have to walk
> all vmas. On the other hand you wont need the below diff in from v1. I do feel the current approach
> in the patch is simpler? But if your point 3 is better in terms of code maintainability, happy to make
> it the change to it in v2.
Yes. Having a toggle that
a) Changes the default of new VMAs to be VM_HUGEPAGE
b) Modifies all existing VMAs that are not VM_NOHUGEPAGE to be VM_HUGEPAGE
c) Is inherited during fork+exec
Would not add any additional checks in our already-complicated THP
allocation logic, it simply changes the default/value of VM_HUGEPAGE.
At least to me, this sounds like better semantics. Would that make your
use case happy?
--
Cheers,
David / dhildenb
Powered by blists - more mailing lists