The return value of task_numa_migrate is unused, remove it.
Signed-off-by: Chuyi Zhou <zhouchuyi@bytedance.com>
---
kernel/sched/fair.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index d5127d9beaea..f544012b9320 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -2486,7 +2486,7 @@ static void task_numa_find_cpu(struct task_numa_env *env,
}
}
-static int task_numa_migrate(struct task_struct *p)
+static void task_numa_migrate(struct task_struct *p)
{
struct task_numa_env env = {
.p = p,
@@ -2531,7 +2531,7 @@ static int task_numa_migrate(struct task_struct *p)
*/
if (unlikely(!sd)) {
sched_setnuma(p, task_node(p));
- return -EINVAL;
+ return;
}
env.dst_nid = p->numa_preferred_nid;
@@ -2600,7 +2600,7 @@ static int task_numa_migrate(struct task_struct *p)
/* No better CPU than the current one was found. */
if (env.best_cpu == -1) {
trace_sched_stick_numa(p, env.src_cpu, NULL, -1);
- return -EAGAIN;
+ return;
}
best_rq = cpu_rq(env.best_cpu);
@@ -2609,7 +2609,7 @@ static int task_numa_migrate(struct task_struct *p)
WRITE_ONCE(best_rq->numa_migrate_on, 0);
if (ret != 0)
trace_sched_stick_numa(p, env.src_cpu, NULL, env.best_cpu);
- return ret;
+ return;
}
ret = migrate_swap(p, env.best_task, env.best_cpu, env.src_cpu);
@@ -2618,7 +2618,6 @@ static int task_numa_migrate(struct task_struct *p)
if (ret != 0)
trace_sched_stick_numa(p, env.src_cpu, env.best_task, env.best_cpu);
put_task_struct(env.best_task);
- return ret;
}
/* Attempt to migrate a task to a CPU on the preferred node. */
--
2.20.1
Hello Chuyi,
On 12/16/2024 5:53 PM, Chuyi Zhou wrote:
> The return value of task_numa_migrate is unused, remove it.
>
> Signed-off-by: Chuyi Zhou <zhouchuyi@bytedance.com>
Feel free to include:
Reviewed-by: K Prateek Nayak <kprateek.nayak@amd.com>
If anyone cares for the history, initial NUMA Balancing implementation
used the return value of task_numa_migrate() to retry NUMA Balancing in
commit 6b9a7460b6ba ("sched/numa: Retry migration of tasks to CPU on a
preferred node") however in the same series[1], Mel also included an
optimization from Rik which retried NUMA Balancing periodically
irrespective the return value from task_numa_migrate() in commit
2739d3eef3a9 ("sched/numa: Retry task_numa_migrate() periodically")
[1] https://lore.kernel.org/all/1381141781-10992-34-git-send-email-mgorman@suse.de/
--
Thanks and Regards,
Prateek
> ---
> kernel/sched/fair.c | 9 ++++-----
> 1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index d5127d9beaea..f544012b9320 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -2486,7 +2486,7 @@ static void task_numa_find_cpu(struct task_numa_env *env,
> }
> }
>
> -static int task_numa_migrate(struct task_struct *p)
> +static void task_numa_migrate(struct task_struct *p)
> {
> struct task_numa_env env = {
> .p = p,
> @@ -2531,7 +2531,7 @@ static int task_numa_migrate(struct task_struct *p)
> */
> if (unlikely(!sd)) {
> sched_setnuma(p, task_node(p));
> - return -EINVAL;
> + return;
> }
>
> env.dst_nid = p->numa_preferred_nid;
> @@ -2600,7 +2600,7 @@ static int task_numa_migrate(struct task_struct *p)
> /* No better CPU than the current one was found. */
> if (env.best_cpu == -1) {
> trace_sched_stick_numa(p, env.src_cpu, NULL, -1);
> - return -EAGAIN;
> + return;
> }
>
> best_rq = cpu_rq(env.best_cpu);
> @@ -2609,7 +2609,7 @@ static int task_numa_migrate(struct task_struct *p)
> WRITE_ONCE(best_rq->numa_migrate_on, 0);
> if (ret != 0)
> trace_sched_stick_numa(p, env.src_cpu, NULL, env.best_cpu);
> - return ret;
> + return;
> }
>
> ret = migrate_swap(p, env.best_task, env.best_cpu, env.src_cpu);
> @@ -2618,7 +2618,6 @@ static int task_numa_migrate(struct task_struct *p)
> if (ret != 0)
> trace_sched_stick_numa(p, env.src_cpu, env.best_task, env.best_cpu);
> put_task_struct(env.best_task);
> - return ret;
> }
>
> /* Attempt to migrate a task to a CPU on the preferred node. */
Hello Prateek,
在 2024/12/18 14:29, K Prateek Nayak 写道:
> Hello Chuyi,
>
> On 12/16/2024 5:53 PM, Chuyi Zhou wrote:
>> The return value of task_numa_migrate is unused, remove it.
>>
>> Signed-off-by: Chuyi Zhou <zhouchuyi@bytedance.com>
>
> Feel free to include:
>
> Reviewed-by: K Prateek Nayak <kprateek.nayak@amd.com>
>
> If anyone cares for the history, initial NUMA Balancing implementation
> used the return value of task_numa_migrate() to retry NUMA Balancing in
> commit 6b9a7460b6ba ("sched/numa: Retry migration of tasks to CPU on a
> preferred node") however in the same series[1], Mel also included an
> optimization from Rik which retried NUMA Balancing periodically
> irrespective the return value from task_numa_migrate() in commit
> 2739d3eef3a9 ("sched/numa: Retry task_numa_migrate() periodically")
>
> [1] https://lore.kernel.org/all/1381141781-10992-34-git-send-email-
> mgorman@suse.de/
>
Thank you for providing the historical information! I will incorporate
it into the next version.
© 2016 - 2025 Red Hat, Inc.