[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160216154443.GW12548@pathway.suse.cz>
Date: Tue, 16 Feb 2016 16:44:43 +0100
From: Petr Mladek <pmladek@...e.com>
To: Tejun Heo <tj@...nel.org>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Oleg Nesterov <oleg@...hat.com>,
Ingo Molnar <mingo@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Steven Rostedt <rostedt@...dmis.org>,
"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
Josh Triplett <josh@...htriplett.org>,
Thomas Gleixner <tglx@...utronix.de>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Jiri Kosina <jkosina@...e.cz>, Borislav Petkov <bp@...e.de>,
Michal Hocko <mhocko@...e.cz>, linux-mm@...ck.org,
Vlastimil Babka <vbabka@...e.cz>, linux-api@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v4 04/22] kthread: Add create_kthread_worker*()
On Mon 2016-01-25 13:53:39, Tejun Heo wrote:
> On Mon, Jan 25, 2016 at 04:44:53PM +0100, Petr Mladek wrote:
> > +struct kthread_worker *
> > +create_kthread_worker_on_cpu(int cpu, const char namefmt[])
> > +{
> > + if (cpu < 0 || cpu > num_possible_cpus())
> > + return ERR_PTR(-EINVAL);
>
> Comparing cpu ID to num_possible_cpus() doesn't make any sense. It
> should either be testing against cpu_possible_mask or testing against
> nr_cpu_ids. Does this test need to be in this function at all?
I wanted to be sure. The cpu number is later passed to
cpu_to_node(cpu) in kthread_create_on_cpu().
I am going to replace this with a check against nr_cpu_ids in
kthread_create_on_cpu() which makes more sense.
I might be too paranoid. But this is slow path. People
do mistakes...
Thanks,
Petr
Powered by blists - more mailing lists