1<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><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> </td><th width="60%" align="center">Internal Functions</th><td width="20%" align="right"> <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 — 
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> </td><td>void * <var class="pdparam">data</var>, </td></tr><tr><td> </td><td>int <var class="pdparam">node</var>, </td></tr><tr><td> </td><td>const char <var class="pdparam">namefmt[]</var>, </td></tr><tr><td> </td><td> <var class="pdparam">...</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div></div><div class="refsect1"><a name="id-1.3.8.30.5"></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     task and thread structures for the thread are allocated on this node
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="id-1.3.8.30.6"></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"><a class="link" href="API-wake-up-process.html" title="wake_up_process">wake_up_process</a></code> to start
17   it.  See also <code class="function"><a class="link" href="API-kthread-run.html" title="kthread_run">kthread_run</a></code>.  The new thread has SCHED_NORMAL policy and
18   is affine to all CPUs.
19   </p><p>
20
21   If thread is going to be bound on a particular cpu, give its node
22   in <em class="parameter"><code>node</code></em>, to get NUMA affinity for kthread stack, or else give NUMA_NO_NODE.
23   When woken, the thread will run <em class="parameter"><code>threadfn</code></em>() with <em class="parameter"><code>data</code></em> as its
24   argument. <em class="parameter"><code>threadfn</code></em>() can either call <code class="function">do_exit</code> directly if it is a
25   standalone thread for which no one will call <code class="function"><a class="link" href="API-kthread-stop.html" title="kthread_stop">kthread_stop</a></code>, or
26   return when '<code class="function"><a class="link" href="API-kthread-should-stop.html" title="kthread_should_stop">kthread_should_stop</a></code>' is true (which means
27   <code class="function"><a class="link" href="API-kthread-stop.html" title="kthread_stop">kthread_stop</a></code> has been called).  The return value should be zero
28   or a negative error number; it will be passed to <code class="function"><a class="link" href="API-kthread-stop.html" title="kthread_stop">kthread_stop</a></code>.
29   </p><p>
30
31   Returns a task_struct or ERR_PTR(-ENOMEM) or ERR_PTR(-EINTR).
32</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> </td><td width="20%" align="center"><a accesskey="u" href="ch01s07.html">Up</a></td><td width="40%" align="right"> <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> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> <span class="phrase">kthread_bind</span></td></tr></table></div></body></html>
33