Re: [PATCH 2/2] memory tiering: introduce folio_has_cpupid() check

From: Zi Yan
Date: Sat Jul 20 2024 - 09:47:32 EST


On 20 Jul 2024, at 3:50, Kefeng Wang wrote:

> On 2024/7/19 22:43, Zi Yan wrote:
>> Instead of open coded check for if memory tiering mode is on and a folio
>> is in the top tier memory, use a function to encapsulate the check.
>>
>> Signed-off-by: Zi Yan <ziy@xxxxxxxxxx>
>> Reviewed-by: "Huang, Ying" <ying.huang@xxxxxxxxx>
>> ---
>> include/linux/memory-tiers.h | 8 ++++++++
>> kernel/sched/fair.c | 3 +--
>> mm/huge_memory.c | 6 ++----
>> mm/memory-tiers.c | 17 +++++++++++++++++
>> mm/memory.c | 3 +--
>> mm/mprotect.c | 3 +--
>> 6 files changed, 30 insertions(+), 10 deletions(-)
>>
>> diff --git a/include/linux/memory-tiers.h b/include/linux/memory-tiers.h
>> index 0dc0cf2863e2..10c127d461c4 100644
>> --- a/include/linux/memory-tiers.h
>> +++ b/include/linux/memory-tiers.h
>> @@ -73,6 +73,10 @@ static inline bool node_is_toptier(int node)
>> }
>> #endif
>> +
>> +bool folio_has_cpupid(struct folio *folio);
>> +
>> +
>> #else
>> #define numa_demotion_enabled false
>> @@ -151,5 +155,9 @@ static inline struct memory_dev_type *mt_find_alloc_memory_type(int adist,
>> static inline void mt_put_memory_types(struct list_head *memory_types)
>> {
>> }
>> +static inline bool folio_has_cpupid(struct folio *folio)
>> +{
>> + return true;
>> +}
>
> Maybe better to move into mm.h since most folio_foo_cpupid()s are there?
Sounds good to me. Will do that in the next version.

--
Best Regards,
Yan, Zi

Attachment: signature.asc
Description: OpenPGP digital signature