回复: [PATCH v2] sched/topology: Free NUMA masks on topology allocation failure

From: Fengyu Wang

Date: Fri Oct 09 2026 - 03:25:23 EST


Hi,

A gentle ping on this patch. Thanks to Tim and Valentin for the reviews. Please let me know if there are any further comments or changes needed.

Thanks,
Fengyu

-----邮件原件-----
发件人: Valentin Schneider <vschneid@xxxxxxxxxx>
发送时间: 2026年8月14日 23:55
收件人: Fengyu Wang <wangfengyu@xxxxxxxx>; Ingo Molnar <mingo@xxxxxxxxxx>; Peter Zijlstra <peterz@xxxxxxxxxxxxx>; Juri Lelli <juri.lelli@xxxxxxxxxx>; Vincent Guittot <vincent.guittot@xxxxxxxxxx>
抄送: Dietmar Eggemann <dietmar.eggemann@xxxxxxx>; Steven Rostedt <rostedt@xxxxxxxxxxx>; Ben Segall <bsegall@xxxxxxxxxx>; Mel Gorman <mgorman@xxxxxxx>; K Prateek Nayak <kprateek.nayak@xxxxxxx>; Chen Yu <yu.c.chen@xxxxxxxxx>; Tim Chen <tim.c.chen@xxxxxxxxxxxxxxx>; Shrikanth Hegde <sshegde@xxxxxxxxxxxxx>; linux-kernel@xxxxxxxxxxxxxxx; Jianyong Wu <wujianyong@xxxxxxxx>; Yuan Zhong <zhongyuan@xxxxxxxx>; Huangsj <huangsj@xxxxxxxx>; Fengyu Wang <wangfengyu@xxxxxxxx>
主题: Re: [PATCH v2] sched/topology: Free NUMA masks on topology allocation failure

On 12/08/26 14:22, Fengyu Wang wrote:
> sched_init_numa() publishes sched_domains_numa_masks before it
> allocates the topology array. When that allocation fails, the early
> return leaves the masks published while sched_domains_numa_levels is
> still zero: nothing dereferences them, but nothing can free them
> either, and the topology they were built for is never installed.
>
> Free the masks on that path, and publish them only once the topology
> array they were built for has been allocated.
>

sched_init_numa() still returns nothing, and an allocation failure in scheduler topology code is pretty much always paired with a dumpster fire, but I guess this may help you get further in the booting process of a borked kernel...

> Fixes: cb83b629bae0 ("sched/numa: Rewrite the CONFIG_NUMA sched domain
> support")
> Signed-off-by: Fengyu Wang <wangfengyu@xxxxxxxx>

Reviewed-by: Valentin Schneider <vschneid@xxxxxxxxxx>