~ubuntu-branches/debian/wheezy/linux-2.6/wheezy

« back to all changes in this revision

Viewing changes to kernel/kthread.c

  • Committer: Bazaar Package Importer
  • Author(s): Ben Hutchings, Ben Hutchings, Aurelien Jarno
  • Date: 2011-06-07 12:14:05 UTC
  • mfrom: (43.1.9 sid)
  • Revision ID: james.westby@ubuntu.com-20110607121405-i3h1rd7nrnd2b73h
Tags: 2.6.39-2
[ Ben Hutchings ]
* [x86] Enable BACKLIGHT_APPLE, replacing BACKLIGHT_MBP_NVIDIA
  (Closes: #627492)
* cgroups: Disable memory resource controller by default. Allow it
  to be enabled using kernel parameter 'cgroup_enable=memory'.
* rt2800usb: Enable support for more USB devices including
  Linksys WUSB600N (Closes: #596626) (this change was accidentally
  omitted from 2.6.39-1)
* [x86] Remove Celeron from list of processors supporting PAE. Most
  'Celeron M' models do not.
* Update debconf template translations:
  - Swedish (Martin Bagge) (Closes: #628932)
  - French (David Prévot) (Closes: #628191)
* aufs: Update for 2.6.39 (Closes: #627837)
* Add stable 2.6.39.1, including:
  - ext4: dont set PageUptodate in ext4_end_bio()
  - pata_cmd64x: fix boot crash on parisc (Closes: #622997, #622745)
  - ext3: Fix fs corruption when make_indexed_dir() fails
  - netfilter: nf_ct_sip: validate Content-Length in TCP SIP messages
  - sctp: fix race between sctp_bind_addr_free() and
    sctp_bind_addr_conflict()
  - sctp: fix memory leak of the ASCONF queue when free asoc
  - md/bitmap: fix saving of events_cleared and other state
  - cdc_acm: Fix oops when Droids MuIn LCD is connected
  - cx88: Fix conversion from BKL to fine-grained locks (Closes: #619827)
  - keys: Set cred->user_ns in key_replace_session_keyring (CVE-2011-2184)
  - tmpfs: fix race between truncate and writepage
  - nfs41: Correct offset for LAYOUTCOMMIT
  - xen/mmu: fix a race window causing leave_mm BUG()
  - ext4: fix possible use-after-free in ext4_remove_li_request()
  For the complete list of changes, see:
   http://www.kernel.org/pub/linux/kernel/v2.6/ChangeLog-2.6.39.1
* Bump ABI to 2
* netfilter: Enable IP_SET, IP_SET_BITMAP_IP, IP_SET_BITMAP_IPMAC,
  IP_SET_BITMAP_PORT, IP_SET_HASH_IP, IP_SET_HASH_IPPORT,
  IP_SET_HASH_IPPORTIP, IP_SET_HASH_IPPORTNET, IP_SET_HASH_NET,
  IP_SET_HASH_NETPORT, IP_SET_LIST_SET, NETFILTER_XT_SET as modules
  (Closes: #629401)

[ Aurelien Jarno ]
* [mipsel/loongson-2f] Disable_SCSI_LPFC to workaround GCC ICE.

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
        /* Information passed to kthread() from kthreadd. */
28
28
        int (*threadfn)(void *data);
29
29
        void *data;
 
30
        int node;
30
31
 
31
32
        /* Result passed back to kthread_create() from kthreadd. */
32
33
        struct task_struct *result;
98
99
        do_exit(ret);
99
100
}
100
101
 
 
102
/* called from do_fork() to get node information for about to be created task */
 
103
int tsk_fork_get_node(struct task_struct *tsk)
 
104
{
 
105
#ifdef CONFIG_NUMA
 
106
        if (tsk == kthreadd_task)
 
107
                return tsk->pref_node_fork;
 
108
#endif
 
109
        return numa_node_id();
 
110
}
 
111
 
101
112
static void create_kthread(struct kthread_create_info *create)
102
113
{
103
114
        int pid;
104
115
 
 
116
#ifdef CONFIG_NUMA
 
117
        current->pref_node_fork = create->node;
 
118
#endif
105
119
        /* We want our own signal handler (we take no signals by default). */
106
120
        pid = kernel_thread(kthread, create, CLONE_FS | CLONE_FILES | SIGCHLD);
107
121
        if (pid < 0) {
111
125
}
112
126
 
113
127
/**
114
 
 * kthread_create - create a kthread.
 
128
 * kthread_create_on_node - create a kthread.
115
129
 * @threadfn: the function to run until signal_pending(current).
116
130
 * @data: data ptr for @threadfn.
 
131
 * @node: memory node number.
117
132
 * @namefmt: printf-style name for the thread.
118
133
 *
119
134
 * Description: This helper function creates and names a kernel
120
135
 * thread.  The thread will be stopped: use wake_up_process() to start
121
136
 * it.  See also kthread_run().
122
137
 *
 
138
 * If thread is going to be bound on a particular cpu, give its node
 
139
 * in @node, to get NUMA affinity for kthread stack, or else give -1.
123
140
 * When woken, the thread will run @threadfn() with @data as its
124
141
 * argument. @threadfn() can either call do_exit() directly if it is a
125
 
 * standalone thread for which noone will call kthread_stop(), or
 
142
 * standalone thread for which no one will call kthread_stop(), or
126
143
 * return when 'kthread_should_stop()' is true (which means
127
144
 * kthread_stop() has been called).  The return value should be zero
128
145
 * or a negative error number; it will be passed to kthread_stop().
129
146
 *
130
147
 * Returns a task_struct or ERR_PTR(-ENOMEM).
131
148
 */
132
 
struct task_struct *kthread_create(int (*threadfn)(void *data),
133
 
                                   void *data,
134
 
                                   const char namefmt[],
135
 
                                   ...)
 
149
struct task_struct *kthread_create_on_node(int (*threadfn)(void *data),
 
150
                                           void *data,
 
151
                                           int node,
 
152
                                           const char namefmt[],
 
153
                                           ...)
136
154
{
137
155
        struct kthread_create_info create;
138
156
 
139
157
        create.threadfn = threadfn;
140
158
        create.data = data;
 
159
        create.node = node;
141
160
        init_completion(&create.done);
142
161
 
143
162
        spin_lock(&kthread_create_lock);
164
183
        }
165
184
        return create.result;
166
185
}
167
 
EXPORT_SYMBOL(kthread_create);
 
186
EXPORT_SYMBOL(kthread_create_on_node);
168
187
 
169
188
/**
170
189
 * kthread_bind - bind a just-created kthread to a cpu.