1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>kthread_create_on_node</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="Linux Device Drivers"><link rel="up" href="ch01s07.html" title="Internal Functions"><link rel="prev" href="API-kthread-freezable-should-stop.html" title="kthread_freezable_should_stop"><link rel="next" href="API-kthread-bind.html" title="kthread_bind"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center"><span class="phrase">kthread_create_on_node</span></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="API-kthread-freezable-should-stop.html">Prev</a>&#160;</td><th width="60%" align="center">Internal Functions</th><td width="20%" align="right">&#160;<a accesskey="n" href="API-kthread-bind.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="API-kthread-create-on-node"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>kthread_create_on_node &#8212; 
2     create a kthread.
3 </p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="funcsynopsis"><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">struct task_struct * <b class="fsfunc">kthread_create_on_node </b>(</code></td><td>int (*<var class="pdparam">threadfn</var>)
4     <code>(</code>void *data<code>)</code>, </td></tr><tr><td>&#160;</td><td>void * <var class="pdparam">data</var>, </td></tr><tr><td>&#160;</td><td>int <var class="pdparam">node</var>, </td></tr><tr><td>&#160;</td><td>const char <var class="pdparam">namefmt[]</var>, </td></tr><tr><td>&#160;</td><td> <var class="pdparam">...</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer">&#160;</div></div></div><div class="refsect1"><a name="idp1108106852"></a><h2>Arguments</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="parameter"><code>threadfn</code></em></span></dt><dd><p>
5     the function to run until signal_pending(current).
6    </p></dd><dt><span class="term"><em class="parameter"><code>data</code></em></span></dt><dd><p>
7     data ptr for <em class="parameter"><code>threadfn</code></em>.
8    </p></dd><dt><span class="term"><em class="parameter"><code>node</code></em></span></dt><dd><p>
9     memory node number.
10    </p></dd><dt><span class="term"><em class="parameter"><code>namefmt[]</code></em></span></dt><dd><p>
11     printf-style name for the thread.
12    </p></dd><dt><span class="term"><em class="parameter"><code>...</code></em></span></dt><dd><p>
13     variable arguments
14    </p></dd></dl></div></div><div class="refsect1"><a name="idp1108112940"></a><h2>Description</h2><p>
15   This helper function creates and names a kernel
16   thread.  The thread will be stopped: use <code class="function">wake_up_process</code> to start
17   it.  See also <code class="function">kthread_run</code>.
18   </p><p>
19
20   If thread is going to be bound on a particular cpu, give its node
21   in <em class="parameter"><code>node</code></em>, to get NUMA affinity for kthread stack, or else give -1.
22   When woken, the thread will run @<code class="function">threadfn</code> with <em class="parameter"><code>data</code></em> as its
23   argument. @<code class="function">threadfn</code> can either call <code class="function">do_exit</code> directly if it is a
24   standalone thread for which no one will call <code class="function">kthread_stop</code>, or
25   return when '<code class="function">kthread_should_stop</code>' is true (which means
26   <code class="function">kthread_stop</code> has been called).  The return value should be zero
27   or a negative error number; it will be passed to <code class="function">kthread_stop</code>.
28   </p><p>
29
30   Returns a task_struct or ERR_PTR(-ENOMEM) or ERR_PTR(-EINTR).
31</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="API-kthread-freezable-should-stop.html">Prev</a>&#160;</td><td width="20%" align="center"><a accesskey="u" href="ch01s07.html">Up</a></td><td width="40%" align="right">&#160;<a accesskey="n" href="API-kthread-bind.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span class="phrase">kthread_freezable_should_stop</span>&#160;</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">&#160;<span class="phrase">kthread_bind</span></td></tr></table></div></body></html>
32