<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/kernel/kthread.c, branch v2.6.31.13</title>
<subtitle>Linux kernel source tree</subtitle>
<id>https://git.amat.us/linux/atom/kernel/kthread.c?h=v2.6.31.13</id>
<link rel='self' href='https://git.amat.us/linux/atom/kernel/kthread.c?h=v2.6.31.13'/>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/'/>
<updated>2009-07-27T19:15:46Z</updated>
<entry>
<title>update the comment in kthread_stop()</title>
<updated>2009-07-27T19:15:46Z</updated>
<author>
<name>Oleg Nesterov</name>
<email>oleg@redhat.com</email>
</author>
<published>2009-06-19T00:51:13Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=9ae260270c90643156cda73427aa1f04c923e627'/>
<id>urn:sha1:9ae260270c90643156cda73427aa1f04c923e627</id>
<content type='text'>
Commit 63706172f332fd3f6e7458ebfb35fa6de9c21dc5 ("kthreads: rework
kthread_stop()") removed the limitation that the thread function mysr
not call do_exit() itself, but forgot to update the comment.

Since that commit it is OK to use kthread_stop() even if kthread can
exit itself.

Signed-off-by: Oleg Nesterov &lt;oleg@redhat.com&gt;
Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>kthreads: rework kthread_stop()</title>
<updated>2009-06-18T20:03:54Z</updated>
<author>
<name>Oleg Nesterov</name>
<email>oleg@redhat.com</email>
</author>
<published>2009-06-17T23:27:45Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=63706172f332fd3f6e7458ebfb35fa6de9c21dc5'/>
<id>urn:sha1:63706172f332fd3f6e7458ebfb35fa6de9c21dc5</id>
<content type='text'>
Based on Eric's patch which in turn was based on my patch.

kthread_stop() has the nasty problems:

- it runs unpredictably long with the global semaphore held.

- it deadlocks if kthread itself does kthread_stop() before it obeys
  the kthread_should_stop() request.

- it is not useable if kthread exits on its own, see for example the
  ugly "wait_to_die:" hack in migration_thread()

- it is not possible to just tell kthread it should stop, we must always
  wait for its exit.

With this patch kthread() allocates all neccesary data (struct kthread) on
its own stack, globals kthread_stop_xxx are deleted.  -&gt;vfork_done is used
as a pointer into "struct kthread", this means kthread_stop() can easily
wait for kthread's exit.

Signed-off-by: Oleg Nesterov &lt;oleg@redhat.com&gt;
Cc: Christoph Hellwig &lt;hch@lst.de&gt;
Cc: "Eric W. Biederman" &lt;ebiederm@xmission.com&gt;
Cc: Ingo Molnar &lt;mingo@elte.hu&gt;
Cc: Pavel Emelyanov &lt;xemul@openvz.org&gt;
Cc: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
Cc: Vitaliy Gusev &lt;vgusev@openvz.org
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>kthreads: simplify the startup synchronization</title>
<updated>2009-06-18T20:03:53Z</updated>
<author>
<name>Oleg Nesterov</name>
<email>oleg@redhat.com</email>
</author>
<published>2009-06-17T23:27:43Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=cdd140bdd6c7bc6395f08877a73c39941501af93'/>
<id>urn:sha1:cdd140bdd6c7bc6395f08877a73c39941501af93</id>
<content type='text'>
We use two completions two create the kernel thread, this is a bit ugly.
kthread() wakes up create_kthread() via -&gt;started, then create_kthread()
wakes up the caller kthread_create() via -&gt;done.  But kthread() does not
need to wait for kthread(), it can just return.  Instead kthread() itself
can wake up the caller of kthread_create().

Kill kthread_create_info-&gt;started, -&gt;done is enough.  This improves the
scalability a bit and sijmplifies the code.

The only problem if kernel_thread() fails, in that case create_kthread()
must do complete(&amp;create-&gt;done).

Signed-off-by: Oleg Nesterov &lt;oleg@redhat.com&gt;
Cc: Christoph Hellwig &lt;hch@lst.de&gt;
Cc: "Eric W. Biederman" &lt;ebiederm@xmission.com&gt;
Cc: Ingo Molnar &lt;mingo@elte.hu&gt;
Cc: Pavel Emelyanov &lt;xemul@openvz.org&gt;
Cc: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
Cc: Vitaliy Gusev &lt;vgusev@openvz.org
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>cpuset,mm: update tasks' mems_allowed in time</title>
<updated>2009-06-17T02:47:31Z</updated>
<author>
<name>Miao Xie</name>
<email>miaox@cn.fujitsu.com</email>
</author>
<published>2009-06-16T22:31:49Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=58568d2a8215cb6f55caf2332017d7bdff954e1c'/>
<id>urn:sha1:58568d2a8215cb6f55caf2332017d7bdff954e1c</id>
<content type='text'>
Fix allocating page cache/slab object on the unallowed node when memory
spread is set by updating tasks' mems_allowed after its cpuset's mems is
changed.

In order to update tasks' mems_allowed in time, we must modify the code of
memory policy.  Because the memory policy is applied in the process's
context originally.  After applying this patch, one task directly
manipulates anothers mems_allowed, and we use alloc_lock in the
task_struct to protect mems_allowed and memory policy of the task.

But in the fast path, we didn't use lock to protect them, because adding a
lock may lead to performance regression.  But if we don't add a lock,the
task might see no nodes when changing cpuset's mems_allowed to some
non-overlapping set.  In order to avoid it, we set all new allowed nodes,
then clear newly disallowed ones.

[lee.schermerhorn@hp.com:
  The rework of mpol_new() to extract the adjusting of the node mask to
  apply cpuset and mpol flags "context" breaks set_mempolicy() and mbind()
  with MPOL_PREFERRED and a NULL nodemask--i.e., explicit local
  allocation.  Fix this by adding the check for MPOL_PREFERRED and empty
  node mask to mpol_new_mpolicy().

  Remove the now unneeded 'nodes = NULL' from mpol_new().

  Note that mpol_new_mempolicy() is always called with a non-NULL
  'nodes' parameter now that it has been removed from mpol_new().
  Therefore, we don't need to test nodes for NULL before testing it for
  'empty'.  However, just to be extra paranoid, add a VM_BUG_ON() to
  verify this assumption.]
[lee.schermerhorn@hp.com:

  I don't think the function name 'mpol_new_mempolicy' is descriptive
  enough to differentiate it from mpol_new().

  This function applies cpuset set context, usually constraining nodes
  to those allowed by the cpuset.  However, when the 'RELATIVE_NODES flag
  is set, it also translates the nodes.  So I settled on
  'mpol_set_nodemask()', because the comment block for mpol_new() mentions
  that we need to call this function to "set nodes".

  Some additional minor line length, whitespace and typo cleanup.]
Signed-off-by: Miao Xie &lt;miaox@cn.fujitsu.com&gt;
Cc: Ingo Molnar &lt;mingo@elte.hu&gt;
Cc: Peter Zijlstra &lt;a.p.zijlstra@chello.nl&gt;
Cc: Christoph Lameter &lt;cl@linux-foundation.org&gt;
Cc: Paul Menage &lt;menage@google.com&gt;
Cc: Nick Piggin &lt;nickpiggin@yahoo.com.au&gt;
Cc: Yasunori Goto &lt;y-goto@jp.fujitsu.com&gt;
Cc: Pekka Enberg &lt;penberg@cs.helsinki.fi&gt;
Cc: David Rientjes &lt;rientjes@google.com&gt;
Signed-off-by: Lee Schermerhorn &lt;lee.schermerhorn@hp.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>tracing/events: move trace point headers into include/trace/events</title>
<updated>2009-04-15T02:05:43Z</updated>
<author>
<name>Steven Rostedt</name>
<email>srostedt@redhat.com</email>
</author>
<published>2009-04-14T23:39:12Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=ad8d75fff811a6a230f7f43b05a6483099349533'/>
<id>urn:sha1:ad8d75fff811a6a230f7f43b05a6483099349533</id>
<content type='text'>
Impact: clean up

Create a sub directory in include/trace called events to keep the
trace point headers in their own separate directory. Only headers that
declare trace points should be defined in this directory.

Cc: Peter Zijlstra &lt;a.p.zijlstra@chello.nl&gt;
Cc: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Cc: Neil Horman &lt;nhorman@tuxdriver.com&gt;
Cc: Zhao Lei &lt;zhaolei@cn.fujitsu.com&gt;
Cc: Eduard - Gabriel Munteanu &lt;eduard.munteanu@linux360.ro&gt;
Cc: Pekka Enberg &lt;penberg@cs.helsinki.fi&gt;
Signed-off-by: Steven Rostedt &lt;rostedt@goodmis.org&gt;
</content>
</entry>
<entry>
<title>tracing: create automated trace defines</title>
<updated>2009-04-14T16:57:28Z</updated>
<author>
<name>Steven Rostedt</name>
<email>srostedt@redhat.com</email>
</author>
<published>2009-04-10T13:36:00Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=a8d154b009168337494fbf345671bab74d3e4b8b'/>
<id>urn:sha1:a8d154b009168337494fbf345671bab74d3e4b8b</id>
<content type='text'>
This patch lowers the number of places a developer must modify to add
new tracepoints. The current method to add a new tracepoint
into an existing system is to write the trace point macro in the
trace header with one of the macros TRACE_EVENT, TRACE_FORMAT or
DECLARE_TRACE, then they must add the same named item into the C file
with the macro DEFINE_TRACE(name) and then add the trace point.

This change cuts out the needing to add the DEFINE_TRACE(name).
Every file that uses the tracepoint must still include the trace/&lt;type&gt;.h
file, but the one C file must also add a define before the including
of that file.

 #define CREATE_TRACE_POINTS
 #include &lt;trace/mytrace.h&gt;

This will cause the trace/mytrace.h file to also produce the C code
necessary to implement the trace point.

Note, if more than one trace/&lt;type&gt;.h is used to create the C code
it is best to list them all together.

 #define CREATE_TRACE_POINTS
 #include &lt;trace/foo.h&gt;
 #include &lt;trace/bar.h&gt;
 #include &lt;trace/fido.h&gt;

Thanks to Mathieu Desnoyers and Christoph Hellwig for coming up with
the cleaner solution of the define above the includes over my first
design to have the C code include a "special" header.

This patch converts sched, irq and lockdep and skb to use this new
method.

Cc: Peter Zijlstra &lt;a.p.zijlstra@chello.nl&gt;
Cc: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Cc: Neil Horman &lt;nhorman@tuxdriver.com&gt;
Cc: Zhao Lei &lt;zhaolei@cn.fujitsu.com&gt;
Cc: Eduard - Gabriel Munteanu &lt;eduard.munteanu@linux360.ro&gt;
Cc: Pekka Enberg &lt;penberg@cs.helsinki.fi&gt;
Signed-off-by: Steven Rostedt &lt;rostedt@goodmis.org&gt;
</content>
</entry>
<entry>
<title>kthread: move sched-realeted initialization from kthreadd context</title>
<updated>2009-04-09T00:20:37Z</updated>
<author>
<name>Oleg Nesterov</name>
<email>oleg@redhat.com</email>
</author>
<published>2009-04-09T15:50:36Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=1c99315bb36b5d776210546d438ca928dc9b1f22'/>
<id>urn:sha1:1c99315bb36b5d776210546d438ca928dc9b1f22</id>
<content type='text'>
kthreadd is the single thread which implements ths "create" request, move
sched_setscheduler/etc from create_kthread() to kthread_create() to
improve the scalability.

We should be careful with sched_setscheduler(), use _nochek helper.

Signed-off-by: Oleg Nesterov &lt;oleg@redhat.com&gt;
Cc: Christoph Hellwig &lt;hch@lst.de&gt;
Cc: "Eric W. Biederman" &lt;ebiederm@xmission.com&gt;
Cc: Ingo Molnar &lt;mingo@elte.hu&gt;
Cc: Pavel Emelyanov &lt;xemul@openvz.org&gt;
Cc: Vitaliy Gusev &lt;vgusev@openvz.org
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
</content>
</entry>
<entry>
<title>kthread: Don't looking for a task in create_kthread() #2</title>
<updated>2009-04-09T00:20:36Z</updated>
<author>
<name>Vitaliy Gusev</name>
<email>vgusev@openvz.org</email>
</author>
<published>2009-04-09T15:50:35Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=3217ab97f14c5c8f9f975ed8c40c351164b0b10e'/>
<id>urn:sha1:3217ab97f14c5c8f9f975ed8c40c351164b0b10e</id>
<content type='text'>
Remove the unnecessary find_task_by_pid_ns(). kthread() can just
use "current" to get the same result.

Signed-off-by: Vitaliy Gusev &lt;vgusev@openvz.org&gt;
Acked-by: Oleg Nesterov &lt;oleg@redhat.com&gt;
Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
</content>
</entry>
<entry>
<title>cpumask: remove dangerous CPU_MASK_ALL_PTR, &amp;CPU_MASK_ALL</title>
<updated>2009-03-30T11:35:11Z</updated>
<author>
<name>Rusty Russell</name>
<email>rusty@rustcorp.com.au</email>
</author>
<published>2009-03-31T04:05:10Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=1a2142afa5646ad5af44bbe1febaa5e0b7e71156'/>
<id>urn:sha1:1a2142afa5646ad5af44bbe1febaa5e0b7e71156</id>
<content type='text'>
Impact: cleanup

(Thanks to Al Viro for reminding me of this, via Ingo)

CPU_MASK_ALL is the (deprecated) "all bits set" cpumask, defined as so:

	#define CPU_MASK_ALL (cpumask_t) { { ... } }

Taking the address of such a temporary is questionable at best,
unfortunately 321a8e9d (cpumask: add CPU_MASK_ALL_PTR macro) added
CPU_MASK_ALL_PTR:

	#define CPU_MASK_ALL_PTR (&amp;CPU_MASK_ALL)

Which formalizes this practice.  One day gcc could bite us over this
usage (though we seem to have gotten away with it so far).

So replace everywhere which used &amp;CPU_MASK_ALL or CPU_MASK_ALL_PTR
with the modern "cpu_all_mask" (a real const struct cpumask *).

Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
Acked-by: Ingo Molnar &lt;mingo@elte.hu&gt;
Reported-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
Cc: Mike Travis &lt;travis@sgi.com&gt;
</content>
</entry>
<entry>
<title>tracepoints: add DECLARE_TRACE() and DEFINE_TRACE()</title>
<updated>2008-11-16T08:01:36Z</updated>
<author>
<name>Mathieu Desnoyers</name>
<email>mathieu.desnoyers@polymtl.ca</email>
</author>
<published>2008-11-14T22:47:47Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=7e066fb870fcd1025ec3ba7bbde5d541094f4ce1'/>
<id>urn:sha1:7e066fb870fcd1025ec3ba7bbde5d541094f4ce1</id>
<content type='text'>
Impact: API *CHANGE*. Must update all tracepoint users.

Add DEFINE_TRACE() to tracepoints to let them declare the tracepoint
structure in a single spot for all the kernel. It helps reducing memory
consumption, especially when declaring a lot of tracepoints, e.g. for
kmalloc tracing.

*API CHANGE WARNING*: now, DECLARE_TRACE() must be used in headers for
tracepoint declarations rather than DEFINE_TRACE(). This is the sane way
to do it. The name previously used was misleading.

Updates scheduler instrumentation to follow this API change.

Signed-off-by: Mathieu Desnoyers &lt;mathieu.desnoyers@polymtl.ca&gt;
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
</entry>
</feed>
