netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Andi Kleen <andi@firstfloor.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	netdev <netdev@vger.kernel.org>,
	David Miller <davem@davemloft.net>, Tejun Heo <tj@kernel.org>,
	Rusty Russell <rusty@rustcorp.com.au>,
	Tony Luck <tony.luck@intel.com>,
	Fenghua Yu <fenghua.yu@intel.com>
Subject: Re: [PATCH v2 3/4] kthread: NUMA aware kthread_create_on_cpu()
Date: Thu, 9 Dec 2010 22:32:10 -0800	[thread overview]
Message-ID: <20101209223210.acd540de.akpm@linux-foundation.org> (raw)
In-Reply-To: <1291960798.2803.18.camel@edumazet-laptop>

On Fri, 10 Dec 2010 06:59:58 +0100 Eric Dumazet <eric.dumazet@gmail.com> wrote:

> Le jeudi 09 d__cembre 2010 __ 16:44 -0800, Andrew Morton a __crit :
> 
> > The name "kthread_create_on_cpu" is pretty misleading.
> > 
> > One would expect such a function to create a kthread which is bound to
> > that CPU.  But what it in fact does is to create a kthread which is
> > bound to all CPUs and whose stack, task_struct and thread_info were
> > allocated from the node which contains `cpu'.
> > 
> > Also, a saner interface would be one which takes the numa_node_id, not
> > the cpu number.
> > 
> 
> 
> > >
> > > ...
> > >
> > >  /**
> > > - * kthread_create - create a kthread.
> > > + * kthread_create_on_cpu - create a kthread.
> > >   * @threadfn: the function to run until signal_pending(current).
> > >   * @data: data ptr for @threadfn.
> > > + * @cpu: cpu number.
> > >   * @namefmt: printf-style name for the thread.
> > >   *
> > >   * Description: This helper function creates and names a kernel
> > >   * thread.  The thread will be stopped: use wake_up_process() to start
> > >   * it.  See also kthread_run().
> > >   *
> > > + * If thread is going to be bound on a particular cpu, give its number
> > > + * in @cpu, to get NUMA affinity for kthread stack, or else give -1.
> > 
> > This is a bit presumptuous.  The caller might wish to later bind this
> > thread to some or all of the CPUs on the node, rather than to a single
> > CPU (eg, kswapd()).
> > 
> > 
> > So what to do?  Maybe add a new kthread_create_node() which prepares a
> > kthread whose memory is bound to that node, then add a
> > kthread_create_cpu() convenience wrapper around that?
> > 
> 
> We probably can add the "bind to cpu" as a fifth patch, to avoid one 
> kthread_bind(p, cpu);  done by these callers.
> 
> My reasoning not including this kthread_bind(p, cpu) in initial patch
> series that I was focusing on NUMA properties first, not on scheduling
> (this part already runs correctly as far as I know)
> 
> Thanks for taking the patch series, I was about to resubmit it today :)
> 

but but but.  The name "kthread_create_on_cpu" sucks.  It's plain wrong.

  reply	other threads:[~2010-12-10  6:32 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-28 19:33 [PATCH] kthread: NUMA aware kthread_create_on_cpu() Eric Dumazet
2010-11-28 22:40 ` Andi Kleen
2010-11-28 22:51   ` Eric Dumazet
2010-11-28 23:01     ` Andi Kleen
2010-11-28 23:37       ` Eric Dumazet
2010-11-29  9:05         ` Andi Kleen
2010-11-29  9:38           ` Eric Dumazet
2010-11-29 15:13             ` [PATCH v2 0/4] " Eric Dumazet
2010-11-29 16:09               ` Andi Kleen
2010-11-29 17:39               ` David Miller
2010-11-29 17:59                 ` Eric Dumazet
2010-11-29 23:31                   ` Rusty Russell
2010-11-29 15:13             ` [PATCH v2 1/4] mm: NUMA aware alloc_task_struct_node() Eric Dumazet
2010-11-29 15:14             ` [PATCH v2 2/4] mm: NUMA aware alloc_thread_info_node() Eric Dumazet
2010-11-29 15:14             ` [PATCH v2 3/4] kthread: NUMA aware kthread_create_on_cpu() Eric Dumazet
2010-12-10  0:44               ` Andrew Morton
2010-12-10  5:59                 ` Eric Dumazet
2010-12-10  6:32                   ` Andrew Morton [this message]
2010-12-10  7:02                     ` Eric Dumazet
2010-12-10  7:09                       ` Andrew Morton
2010-12-13  6:26                         ` Thomas Fjellstrom
2010-11-29 15:15             ` [PATCH v2 4/4] kthread: use kthread_create_on_cpu() Eric Dumazet
2010-11-29 15:19               ` Tejun Heo
2010-11-30  9:38             ` David Howells
2010-11-30  9:59               ` Eric Dumazet
2010-11-29  9:03       ` [PATCH] kthread: NUMA aware kthread_create_on_cpu() Américo Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20101209223210.acd540de.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=andi@firstfloor.org \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=fenghua.yu@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    --cc=tj@kernel.org \
    --cc=tony.luck@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).