[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YUx+XcYQlQ4SqEj8@hirez.programming.kicks-ass.net>
Date: Thu, 23 Sep 2021 15:17:17 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Petr Mladek <pmladek@...e.com>
Cc: gor@...ux.ibm.com, jpoimboe@...hat.com, jikos@...nel.org,
mbenes@...e.cz, mingo@...nel.org, linux-kernel@...r.kernel.org,
joe.lawrence@...hat.com, fweisbec@...il.com, tglx@...utronix.de,
hca@...ux.ibm.com, svens@...ux.ibm.com, sumanthk@...ux.ibm.com,
live-patching@...r.kernel.org, paulmck@...nel.org
Subject: Re: [RFC][PATCH 3/7] sched,livepatch: Use task_try_func()
On Thu, Sep 23, 2021 at 02:05:00PM +0200, Petr Mladek wrote:
> On Wed 2021-09-22 13:05:09, Peter Zijlstra wrote:
> > +static int klp_check_task(struct task_struct *task, void *arg)
>
> Please, call this klp_check_and_switch_task() to make it clear
> that it actually does the switch.
Sure.
> > + ret = task_try_func(task, klp_check_task, &old_name);
> > + switch (ret) {
> > + case -EBUSY:
> > + pr_debug("%s: %s:%d is running\n",
> > + __func__, task->comm, task->pid);
> > + break;
> > + case -EINVAL:
> > + pr_debug("%s: %s:%d has an unreliable stack\n",
> > + __func__, task->comm, task->pid);
> > + break;
> > + case -EADDRINUSE:
> > + pr_debug("%s: %s:%d is sleeping on function %s\n",
> > + __func__, task->comm, task->pid, old_name);
> > + break;
>
> I would prefer to be on the safe side and catch error codes that might
> eventually appear in the future.
>
> case 0:
> /* success */
> break;
case -EAGAIN:
/* task_try_func() raced */
break;
> default:
> pr_debug("%s: Unknown error code (%d) when trying to switch %s:%d\n",
> __func__, ret, task->comm, task->pid);
>
> > }
Done.
Powered by blists - more mailing lists