[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <xhsmhtsztlqqh.mognet@vschneid-thinkpadt14sgen2i.remote.csb>
Date: Mon, 20 Oct 2025 14:09:10 +0200
From: Valentin Schneider <vschneid@...hat.com>
To: Luo Gengkun <luogengkun@...weicloud.com>, mingo@...hat.com
Cc: peterz@...radead.org, juri.lelli@...hat.com, vincent.guittot@...aro.org,
dietmar.eggemann@....com, rostedt@...dmis.org, bsegall@...gle.com,
mgorman@...e.de, huang.ying.caritas@...il.com,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] sched/topology: Fix memory leak in the error path of
sched_init_numa
On 14/10/25 08:36, Luo Gengkun wrote:
> @@ -2003,15 +2017,19 @@ void sched_init_numa(int offline_node)
> */
> for (i = 0; i < nr_levels; i++) {
> masks[i] = kzalloc(nr_node_ids * sizeof(void *), GFP_KERNEL);
> - if (!masks[i])
> + if (!masks[i]) {
> + __sched_free_masks(masks, nr_levels);
This could be passed 'i + 1' instead of nr_levels.
> return;
So the tricky thing here is sched_init_numa() doesn't have a return value
pretty much because it's not meant to fail, if you get memory allocation
issues while setting up scheduler structures then things are not looking
good at all...
Best case scenario would be the rest of the topology gets set up correctly
and you get non-NUMA aware scheduling, but AFAICT the call order is
sched_cpu_activate()
sched_init_numa()
partition_sched_domains()
So if the NUMA topology setup failed, the regular topology setup isn't
going to fare much better.
Anywho, there's nothing wrong with your patch, it's just that in case of an
issue it IMO doesn't improve the situation much.
Powered by blists - more mailing lists