[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <03641edd-3975-433e-a8d7-d79cb422dc57@igalia.com>
Date: Fri, 28 Jun 2024 10:03:37 +0100
From: Tvrtko Ursulin <tvrtko.ursulin@...lia.com>
To: Andrew Morton <akpm@...ux-foundation.org>,
Tvrtko Ursulin <tursulin@...lia.com>
Cc: linux-mm@...ck.org, linux-kernel@...r.kernel.org, kernel-dev@...lia.com,
Huang Ying <ying.huang@...el.com>, Mel Gorman <mgorman@...e.de>,
Peter Zijlstra <peterz@...radead.org>, Ingo Molnar <mingo@...hat.com>,
Rik van Riel <riel@...riel.com>, Johannes Weiner <hannes@...xchg.org>,
"Matthew Wilcox (Oracle)" <willy@...radead.org>,
Dave Hansen <dave.hansen@...el.com>, Andi Kleen <ak@...ux.intel.com>,
Michal Hocko <mhocko@...e.com>, David Rientjes <rientjes@...gle.com>
Subject: Re: [PATCH] mm/numa_balancing: Teach mpol_to_str about the balancing
mode
On 27/06/2024 22:37, Andrew Morton wrote:
> On Tue, 25 Jun 2024 14:26:05 +0100 Tvrtko Ursulin <tursulin@...lia.com> wrote:
>
>> From: Tvrtko Ursulin <tvrtko.ursulin@...lia.com>
>>
>> If a task has had MPOL_F_NUMA_BALANCING set it is useful to show that in
>> procfs. Teach the mpol_to_str helper about its existance and while at it
>> update the comment to account for "weighted interleave" when suggesting
>> a recommended buffer size.
>>
>> ...
>>
>> --- a/mm/mempolicy.c
>> +++ b/mm/mempolicy.c
>> @@ -3293,8 +3293,9 @@ int mpol_parse_str(char *str, struct mempolicy **mpol)
>> * @pol: pointer to mempolicy to be formatted
>> *
>> * Convert @pol into a string. If @buffer is too short, truncate the string.
>> - * Recommend a @maxlen of at least 32 for the longest mode, "interleave", the
>> - * longest flag, "relative", and to display at least a few node ids.
>> + * Recommend a @maxlen of at least 42 for the longest mode, "weighted
>> + * interleave", the longest flag, "balancing", and to display at least a few
>> + * node ids.
>> */
>> void mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol)
>> {
>> @@ -3331,12 +3332,15 @@ void mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol)
>> p += snprintf(p, buffer + maxlen - p, "=");
>>
>> /*
>> - * Currently, the only defined flags are mutually exclusive
>> + * The below two flags are mutually exclusive:
>> */
>> if (flags & MPOL_F_STATIC_NODES)
>> p += snprintf(p, buffer + maxlen - p, "static");
>> else if (flags & MPOL_F_RELATIVE_NODES)
>> p += snprintf(p, buffer + maxlen - p, "relative");
>> +
>> + if (flags & MPOL_F_NUMA_BALANCING)
>> + p += snprintf(p, buffer + maxlen - p, "balancing");
>> }
>>
>> if (!nodes_empty(nodes))
>
> Is it strange to report this via mount options? `static' and
> `relative' can be set via mount options but afaict `balancing' cannot?
> I guess not...
>
> Documentation/filesystems/tmpfs.rst appears to be a suitable place to
> document this new userspace API please.
That was the part I was unsure of - whether it makes sense to allow
passing in 'balancing' via tmpfs.
I just noticed these few oddities while playing with some new NUMA
policies and attempted (badly) to at least fix the fact 'balancing' is
not shown in /proc/<pid>/numa_maps if selected via set_mempolicy/mbind.
So I also have a patch to allow 'balancing' to be parsed as tmpfs mount
option but did not post it yet. Now that Ying has uncovered problems in
this code go deeper we will see how this all develops.
Regards,
Tvrtko
Powered by blists - more mailing lists