[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <DFIKE4Z23Q0O.2ZC7FR40XO8SR@kernel.org>
Date: Wed, 07 Jan 2026 19:22:15 +0100
From: "Danilo Krummrich" <dakr@...nel.org>
To: "Jinhui Guo" <guojinhui.liam@...edance.com>
Cc: <alexander.h.duyck@...ux.intel.com>, <alexanderduyck@...com>,
<bhelgaas@...gle.com>, <bvanassche@....org>, <dan.j.williams@...el.com>,
<gregkh@...uxfoundation.org>, <helgaas@...nel.org>, <rafael@...nel.org>,
<tj@...nel.org>, <linux-kernel@...r.kernel.org>,
<linux-pci@...r.kernel.org>
Subject: Re: [PATCH 2/3] driver core: Add NUMA-node awareness to the
synchronous probe path
On Wed Jan 7, 2026 at 6:55 PM CET, Jinhui Guo wrote:
> + * __exec_on_numa_node - Execute a function on a specific NUMA node synchronously
> + * @node: Target NUMA node ID
> + * @func: The wrapper function to execute
> + * @arg1: First argument (void *)
> + * @arg2: Second argument (void *)
> + *
> + * Returns the result of the function execution, or -ENODEV if initialization fails.
> + * If the node is invalid or offline, it falls back to local execution.
> + */
> +static int __exec_on_numa_node(int node, numa_func_t func, void *arg1, void *arg2)
> +{
> + struct numa_work_ctx ctx;
> +
> + /* Fallback to local execution if the node is invalid or offline */
> + if (node < 0 || node >= MAX_NUMNODES || !node_online(node))
> + return func(arg1, arg2);
Just a quick drive-by comment (I’ll go through it more thoroughly later).
What about the case where we are already on the requested node?
Also, we should probably set the corresponding CPU affinity for the time we are
executing func() to prevent migration.
> +
> + ctx.func = func;
> + ctx.arg1 = arg1;
> + ctx.arg2 = arg2;
> + ctx.result = -ENODEV;
> + INIT_WORK_ONSTACK(&ctx.work, numa_work_func);
> +
> + /* Use system_dfl_wq to allow execution on the specific node. */
> + queue_work_node(node, system_dfl_wq, &ctx.work);
> + flush_work(&ctx.work);
> + destroy_work_on_stack(&ctx.work);
> +
> + return ctx.result;
> +}
Powered by blists - more mailing lists