Re: [PATCH linux-next RESEND] sched/core: Add WARN() to checks in migrate_disable()
From: Steven Rostedt
Date: Tue Jul 02 2024 - 12:43:46 EST
On Tue, 2 Jul 2024 19:33:59 +0800 (CST)
<xu.xin16@xxxxxxxxxx> wrote:
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -2259,6 +2259,8 @@ void migrate_disable(void)
> struct task_struct *p = current;
>
> if (p->migration_disabled) {
> + if (p->migration_disabled == USHRT_MAX)
> + WARN(1, "migration_disabled has encountered an overflow.\n");
This is redundant, you want:
WARN(p->migration_disabled == USHRT_MAX, "migration_disabled has encountered an overflow.");
I'm not sure the '\n' is needed, but it seems like 50% of WARN() has
them, and 50% do not.
-- Steve
> p->migration_disabled++;
> return;
> }