---
name: "kthread_create_on_node"
section: "9"
platform: "linux"
package: "linux-manual-3.16"
version: "3.16.56-1+deb8u1"
release: "Debian 8 (Jessie)"
platforms: ["linux"]
url: "https://new.carta.tech/kthread_create_on_node"
---

# kthread\_create\_on\_node(9)

create a kthread.

## NAME

kthread\_create\_on\_node - create a kthread.

## SYNOPSIS

**struct task\_struct \* kthread\_create\_on\_node(int (\****threadfn***) (void \*data), void \*** *data***, int** *node***, const char** *namefmt\[\]***,** *...***);**

## ARGUMENTS

*threadfn*

the function to run until signal\_pending(current).

*data*

data ptr for *threadfn*.

*node*

memory node number.

*namefmt\[\]*

printf-style name for the thread.

*...*

variable arguments

## 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 node in *node*, to get NUMA affinity for kthread stack, or else give -1. When woken, the thread will run *threadfn*() with *data* as its argument. *threadfn*() can either call **do\_exit** directly if it is a standalone thread for which no one will call **kthread\_stop**, or return when '**kthread\_should\_stop**' is true (which means **kthread\_stop** has been called). The return value should be zero or a negative error number; it will be passed to **kthread\_stop**.

Returns a task\_struct or ERR\_PTR(-ENOMEM) or ERR\_PTR(-EINTR).

## COPYRIGHT
