<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-toradex.git/block/blk-ioc.c, branch v3.4.49</title>
<subtitle>Linux kernel for Apalis and Colibri modules</subtitle>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/'/>
<entry>
<title>block: fix ioc leak in put_io_context</title>
<updated>2012-03-14T14:34:48+00:00</updated>
<author>
<name>Xiaotian Feng</name>
<email>xtfeng@gmail.com</email>
</author>
<published>2012-03-14T14:34:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=ff8c1474cc2f5e11414c71ec4d739c18e6e669c0'/>
<id>ff8c1474cc2f5e11414c71ec4d739c18e6e669c0</id>
<content type='text'>
When put_io_context is called, if ioc-&gt;icq_list is empty and refcount
is 1, kernel will not free the ioc.

This is caught by following kmemleak:

unreferenced object 0xffff880036349fe0 (size 216):
  comm "sh", pid 2137, jiffies 4294931140 (age 290579.412s)
  hex dump (first 32 bytes):
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    01 00 01 00 ad 4e ad de ff ff ff ff 00 00 00 00  .....N..........
  backtrace:
    [&lt;ffffffff8169f926&gt;] kmemleak_alloc+0x26/0x50
    [&lt;ffffffff81195a9c&gt;] kmem_cache_alloc_node+0x1cc/0x2a0
    [&lt;ffffffff81356b67&gt;] create_io_context_slowpath+0x27/0x130
    [&lt;ffffffff81356d2b&gt;] get_task_io_context+0xbb/0xf0
    [&lt;ffffffff81055f0e&gt;] copy_process+0x188e/0x18b0
    [&lt;ffffffff8105609b&gt;] do_fork+0x11b/0x420
    [&lt;ffffffff810247f8&gt;] sys_clone+0x28/0x30
    [&lt;ffffffff816d3373&gt;] stub_clone+0x13/0x20
    [&lt;ffffffffffffffff&gt;] 0xffffffffffffffff

ioc should be freed if ioc-&gt;icq_list is empty.
Signed-off-by: Xiaotian Feng &lt;dannyfeng@tencent.com&gt;
Acked-by: Vivek Goyal &lt;vgoyal@redhat.com&gt;
Acked-by: Tejun Heo &lt;tj@kernel.org&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When put_io_context is called, if ioc-&gt;icq_list is empty and refcount
is 1, kernel will not free the ioc.

This is caught by following kmemleak:

unreferenced object 0xffff880036349fe0 (size 216):
  comm "sh", pid 2137, jiffies 4294931140 (age 290579.412s)
  hex dump (first 32 bytes):
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    01 00 01 00 ad 4e ad de ff ff ff ff 00 00 00 00  .....N..........
  backtrace:
    [&lt;ffffffff8169f926&gt;] kmemleak_alloc+0x26/0x50
    [&lt;ffffffff81195a9c&gt;] kmem_cache_alloc_node+0x1cc/0x2a0
    [&lt;ffffffff81356b67&gt;] create_io_context_slowpath+0x27/0x130
    [&lt;ffffffff81356d2b&gt;] get_task_io_context+0xbb/0xf0
    [&lt;ffffffff81055f0e&gt;] copy_process+0x188e/0x18b0
    [&lt;ffffffff8105609b&gt;] do_fork+0x11b/0x420
    [&lt;ffffffff810247f8&gt;] sys_clone+0x28/0x30
    [&lt;ffffffff816d3373&gt;] stub_clone+0x13/0x20
    [&lt;ffffffffffffffff&gt;] 0xffffffffffffffff

ioc should be freed if ioc-&gt;icq_list is empty.
Signed-off-by: Xiaotian Feng &lt;dannyfeng@tencent.com&gt;
Acked-by: Vivek Goyal &lt;vgoyal@redhat.com&gt;
Acked-by: Tejun Heo &lt;tj@kernel.org&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>block: exit_io_context() should call elevator_exit_icq_fn()</title>
<updated>2012-02-15T08:45:53+00:00</updated>
<author>
<name>Tejun Heo</name>
<email>tj@kernel.org</email>
</author>
<published>2012-02-15T08:45:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=621032ad6eaabf2fe771c4fa0d8f58e1fcfcdba6'/>
<id>621032ad6eaabf2fe771c4fa0d8f58e1fcfcdba6</id>
<content type='text'>
While updating locking, b2efa05265 "block, cfq: unlink
cfq_io_context's immediately" moved elevator_exit_icq_fn() invocation
from exit_io_context() to the final ioc put.  While this doesn't cause
catastrophic failure, it effectively removes task exit notification to
elevator and cause noticeable IO performance degradation with CFQ.

On task exit, CFQ used to immediately expire the slice if it was being
used by the exiting task as no more IO would be issued by the task;
however, after b2efa05265, the notification is lost and disk could sit
idle needlessly, leading to noticeable IO performance degradation for
certain workloads.

This patch renames ioc_exit_icq() to ioc_destroy_icq(), separates
elevator_exit_icq_fn() invocation into ioc_exit_icq() and invokes it
from exit_io_context().  ICQ_EXITED flag is added to avoid invoking
the callback more than once for the same icq.

Walking icq_list from ioc side and invoking elevator callback requires
reverse double locking.  This may be better implemented using RCU;
unfortunately, using RCU isn't trivial.  e.g. RCU protection would
need to cover request_queue and queue_lock switch on cleanup makes
grabbing queue_lock from RCU unsafe.  Reverse double locking should
do, at least for now.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Reported-and-bisected-by: Shaohua Li &lt;shli@kernel.org&gt;
LKML-Reference: &lt;CANejiEVzs=pUhQSTvUppkDcc2TNZyfohBRLygW5zFmXyk5A-xQ@mail.gmail.com&gt;
Tested-by: Shaohua Li &lt;shaohua.li@intel.com&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
While updating locking, b2efa05265 "block, cfq: unlink
cfq_io_context's immediately" moved elevator_exit_icq_fn() invocation
from exit_io_context() to the final ioc put.  While this doesn't cause
catastrophic failure, it effectively removes task exit notification to
elevator and cause noticeable IO performance degradation with CFQ.

On task exit, CFQ used to immediately expire the slice if it was being
used by the exiting task as no more IO would be issued by the task;
however, after b2efa05265, the notification is lost and disk could sit
idle needlessly, leading to noticeable IO performance degradation for
certain workloads.

This patch renames ioc_exit_icq() to ioc_destroy_icq(), separates
elevator_exit_icq_fn() invocation into ioc_exit_icq() and invokes it
from exit_io_context().  ICQ_EXITED flag is added to avoid invoking
the callback more than once for the same icq.

Walking icq_list from ioc side and invoking elevator callback requires
reverse double locking.  This may be better implemented using RCU;
unfortunately, using RCU isn't trivial.  e.g. RCU protection would
need to cover request_queue and queue_lock switch on cleanup makes
grabbing queue_lock from RCU unsafe.  Reverse double locking should
do, at least for now.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Reported-and-bisected-by: Shaohua Li &lt;shli@kernel.org&gt;
LKML-Reference: &lt;CANejiEVzs=pUhQSTvUppkDcc2TNZyfohBRLygW5zFmXyk5A-xQ@mail.gmail.com&gt;
Tested-by: Shaohua Li &lt;shaohua.li@intel.com&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>block: simplify ioc_release_fn()</title>
<updated>2012-02-15T08:45:52+00:00</updated>
<author>
<name>Tejun Heo</name>
<email>tj@kernel.org</email>
</author>
<published>2012-02-15T08:45:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=2274b029f640cd652ab59c363e5beebf5f50e609'/>
<id>2274b029f640cd652ab59c363e5beebf5f50e609</id>
<content type='text'>
Reverse double lock dancing in ioc_release_fn() can be simplified by
just using trylock on the queue_lock and back out from ioc lock on
trylock failure.  Simplify it.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Tested-by: Shaohua Li &lt;shaohua.li@intel.com&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Reverse double lock dancing in ioc_release_fn() can be simplified by
just using trylock on the queue_lock and back out from ioc lock on
trylock failure.  Simplify it.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Tested-by: Shaohua Li &lt;shaohua.li@intel.com&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>block: replace icq-&gt;changed with icq-&gt;flags</title>
<updated>2012-02-15T08:45:49+00:00</updated>
<author>
<name>Tejun Heo</name>
<email>tj@kernel.org</email>
</author>
<published>2012-02-15T08:45:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=d705ae6b133f9f6a8beee617b1224b6a5c99c5da'/>
<id>d705ae6b133f9f6a8beee617b1224b6a5c99c5da</id>
<content type='text'>
icq-&gt;changed was used for ICQ_*_CHANGED bits.  Rename it to flags and
access it under ioc-&gt;lock instead of using atomic bitops.
ioc_get_changed() is added so that the changed part can be fetched and
cleared as before.

icq-&gt;flags will be used to carry other flags.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Tested-by: Shaohua Li &lt;shaohua.li@intel.com&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
icq-&gt;changed was used for ICQ_*_CHANGED bits.  Rename it to flags and
access it under ioc-&gt;lock instead of using atomic bitops.
ioc_get_changed() is added so that the changed part can be fetched and
cleared as before.

icq-&gt;flags will be used to carry other flags.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Tested-by: Shaohua Li &lt;shaohua.li@intel.com&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>block: fix lockdep warning on io_context release put_io_context()</title>
<updated>2012-02-11T11:37:25+00:00</updated>
<author>
<name>Tejun Heo</name>
<email>tj@kernel.org</email>
</author>
<published>2012-02-11T11:37:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=d8c66c5d59247e25a69428aced0b79d33b9c66d6'/>
<id>d8c66c5d59247e25a69428aced0b79d33b9c66d6</id>
<content type='text'>
11a3122f6c "block: strip out locking optimization in put_io_context()"
removed ioc_lock depth lockdep annoation along with locking
optimization; however, while recursing from put_io_context() is no
longer possible, ioc_release_fn() may still end up putting the last
reference of another ioc through elevator, which wlil grab ioc-&gt;lock
triggering spurious (as the ioc is always different one) A-A deadlock
warning.

As this can only happen one time from ioc_release_fn(), using non-zero
subclass from ioc_release_fn() is enough.  Use subclass 1.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
11a3122f6c "block: strip out locking optimization in put_io_context()"
removed ioc_lock depth lockdep annoation along with locking
optimization; however, while recursing from put_io_context() is no
longer possible, ioc_release_fn() may still end up putting the last
reference of another ioc through elevator, which wlil grab ioc-&gt;lock
triggering spurious (as the ioc is always different one) A-A deadlock
warning.

As this can only happen one time from ioc_release_fn(), using non-zero
subclass from ioc_release_fn() is enough.  Use subclass 1.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>block: strip out locking optimization in put_io_context()</title>
<updated>2012-02-07T06:51:30+00:00</updated>
<author>
<name>Tejun Heo</name>
<email>tj@kernel.org</email>
</author>
<published>2012-02-07T06:51:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=11a3122f6cf2d988a77eb8883d0fc49cd013a6d5'/>
<id>11a3122f6cf2d988a77eb8883d0fc49cd013a6d5</id>
<content type='text'>
put_io_context() performed a complex trylock dancing to avoid
deferring ioc release to workqueue.  It was also broken on UP because
trylock was always assumed to succeed which resulted in unbalanced
preemption count.

While there are ways to fix the UP breakage, even the most
pathological microbench (forced ioc allocation and tight fork/exit
loop) fails to show any appreciable performance benefit of the
optimization.  Strip it out.  If there turns out to be workloads which
are affected by this change, simpler optimization from the discussion
thread can be applied later.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
LKML-Reference: &lt;1328514611.21268.66.camel@sli10-conroe&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
put_io_context() performed a complex trylock dancing to avoid
deferring ioc release to workqueue.  It was also broken on UP because
trylock was always assumed to succeed which resulted in unbalanced
preemption count.

While there are ways to fix the UP breakage, even the most
pathological microbench (forced ioc allocation and tight fork/exit
loop) fails to show any appreciable performance benefit of the
optimization.  Strip it out.  If there turns out to be workloads which
are affected by this change, simpler optimization from the discussion
thread can be applied later.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
LKML-Reference: &lt;1328514611.21268.66.camel@sli10-conroe&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>block: fix ioc locking warning</title>
<updated>2012-02-06T07:57:29+00:00</updated>
<author>
<name>Shaohua Li</name>
<email>shaohua.li@intel.com</email>
</author>
<published>2012-02-06T07:57:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=9fa73472ddbcd3da87d35a7f4566eaaf345f798e'/>
<id>9fa73472ddbcd3da87d35a7f4566eaaf345f798e</id>
<content type='text'>
Meelis reported a warning:

WARNING: at kernel/timer.c:1122 run_timer_softirq+0x199/0x1ec()
Hardware name: 939Dual-SATA2
timer: cfq_idle_slice_timer+0x0/0xaa preempt leak: 00000102 -&gt; 00000103
Modules linked in: sr_mod cdrom videodev media drm_kms_helper ohci_hcd ehci_hcd v4l2_compat_ioctl32 usbcore i2c_ali15x3 snd_seq drm snd_timer snd_seq
Pid: 0, comm: swapper Not tainted 3.3.0-rc2-00110-gd125666 #176
Call Trace:
 &lt;IRQ&gt;  [&lt;ffffffff81022aaa&gt;] warn_slowpath_common+0x7e/0x96
 [&lt;ffffffff8114c485&gt;] ? cfq_slice_expired+0x1d/0x1d
 [&lt;ffffffff81022b56&gt;] warn_slowpath_fmt+0x41/0x43
 [&lt;ffffffff8114c526&gt;] ? cfq_idle_slice_timer+0xa1/0xaa
 [&lt;ffffffff8114c485&gt;] ? cfq_slice_expired+0x1d/0x1d
 [&lt;ffffffff8102c124&gt;] run_timer_softirq+0x199/0x1ec
 [&lt;ffffffff81047a53&gt;] ? timekeeping_get_ns+0x12/0x31
 [&lt;ffffffff810145fd&gt;] ? apic_write+0x11/0x13
 [&lt;ffffffff81027475&gt;] __do_softirq+0x74/0xfa
 [&lt;ffffffff812f337a&gt;] call_softirq+0x1a/0x30
 [&lt;ffffffff81002ff9&gt;] do_softirq+0x31/0x68
 [&lt;ffffffff810276cf&gt;] irq_exit+0x3d/0xa3
 [&lt;ffffffff81014aca&gt;] smp_apic_timer_interrupt+0x6b/0x77
 [&lt;ffffffff812f2de9&gt;] apic_timer_interrupt+0x69/0x70
 &lt;EOI&gt;  [&lt;ffffffff81040136&gt;] ? sched_clock_cpu+0x73/0x7d
 [&lt;ffffffff81040136&gt;] ? sched_clock_cpu+0x73/0x7d
 [&lt;ffffffff8100801f&gt;] ? default_idle+0x1e/0x32
 [&lt;ffffffff81008019&gt;] ? default_idle+0x18/0x32
 [&lt;ffffffff810008b1&gt;] cpu_idle+0x87/0xd1
 [&lt;ffffffff812de861&gt;] rest_init+0x85/0x89
 [&lt;ffffffff81659a4d&gt;] start_kernel+0x2eb/0x2f8
 [&lt;ffffffff8165926e&gt;] x86_64_start_reservations+0x7e/0x82
 [&lt;ffffffff81659362&gt;] x86_64_start_kernel+0xf0/0xf7

this_q == locked_q is possible. There are two problems here:
1. In UP case, there is preemption counter issue as spin_trylock always
successes.
2. In SMP case, the loop breaks too earlier.

Signed-off-by: Shaohua Li &lt;shaohua.li@intel.com&gt;
Reported-by: Meelis Roos &lt;mroos@linux.ee&gt;
Reported-by: Knut Petersen &lt;Knut_Petersen@t-online.de&gt;
Tested-by: Knut Petersen &lt;Knut_Petersen@t-online.de&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Meelis reported a warning:

WARNING: at kernel/timer.c:1122 run_timer_softirq+0x199/0x1ec()
Hardware name: 939Dual-SATA2
timer: cfq_idle_slice_timer+0x0/0xaa preempt leak: 00000102 -&gt; 00000103
Modules linked in: sr_mod cdrom videodev media drm_kms_helper ohci_hcd ehci_hcd v4l2_compat_ioctl32 usbcore i2c_ali15x3 snd_seq drm snd_timer snd_seq
Pid: 0, comm: swapper Not tainted 3.3.0-rc2-00110-gd125666 #176
Call Trace:
 &lt;IRQ&gt;  [&lt;ffffffff81022aaa&gt;] warn_slowpath_common+0x7e/0x96
 [&lt;ffffffff8114c485&gt;] ? cfq_slice_expired+0x1d/0x1d
 [&lt;ffffffff81022b56&gt;] warn_slowpath_fmt+0x41/0x43
 [&lt;ffffffff8114c526&gt;] ? cfq_idle_slice_timer+0xa1/0xaa
 [&lt;ffffffff8114c485&gt;] ? cfq_slice_expired+0x1d/0x1d
 [&lt;ffffffff8102c124&gt;] run_timer_softirq+0x199/0x1ec
 [&lt;ffffffff81047a53&gt;] ? timekeeping_get_ns+0x12/0x31
 [&lt;ffffffff810145fd&gt;] ? apic_write+0x11/0x13
 [&lt;ffffffff81027475&gt;] __do_softirq+0x74/0xfa
 [&lt;ffffffff812f337a&gt;] call_softirq+0x1a/0x30
 [&lt;ffffffff81002ff9&gt;] do_softirq+0x31/0x68
 [&lt;ffffffff810276cf&gt;] irq_exit+0x3d/0xa3
 [&lt;ffffffff81014aca&gt;] smp_apic_timer_interrupt+0x6b/0x77
 [&lt;ffffffff812f2de9&gt;] apic_timer_interrupt+0x69/0x70
 &lt;EOI&gt;  [&lt;ffffffff81040136&gt;] ? sched_clock_cpu+0x73/0x7d
 [&lt;ffffffff81040136&gt;] ? sched_clock_cpu+0x73/0x7d
 [&lt;ffffffff8100801f&gt;] ? default_idle+0x1e/0x32
 [&lt;ffffffff81008019&gt;] ? default_idle+0x18/0x32
 [&lt;ffffffff810008b1&gt;] cpu_idle+0x87/0xd1
 [&lt;ffffffff812de861&gt;] rest_init+0x85/0x89
 [&lt;ffffffff81659a4d&gt;] start_kernel+0x2eb/0x2f8
 [&lt;ffffffff8165926e&gt;] x86_64_start_reservations+0x7e/0x82
 [&lt;ffffffff81659362&gt;] x86_64_start_kernel+0xf0/0xf7

this_q == locked_q is possible. There are two problems here:
1. In UP case, there is preemption counter issue as spin_trylock always
successes.
2. In SMP case, the loop breaks too earlier.

Signed-off-by: Shaohua Li &lt;shaohua.li@intel.com&gt;
Reported-by: Meelis Roos &lt;mroos@linux.ee&gt;
Reported-by: Knut Petersen &lt;Knut_Petersen@t-online.de&gt;
Tested-by: Knut Petersen &lt;Knut_Petersen@t-online.de&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>block: remove WARN_ON_ONCE() in exit_io_context()</title>
<updated>2011-12-27T17:52:16+00:00</updated>
<author>
<name>Tejun Heo</name>
<email>tj@kernel.org</email>
</author>
<published>2011-12-27T17:52:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=c98b2cc29af8e84e7364b53e9bb4cc7cfaf62555'/>
<id>c98b2cc29af8e84e7364b53e9bb4cc7cfaf62555</id>
<content type='text'>
6e736be7 "block: make ioc get/put interface more conventional and fix
race on alloction" added WARN_ON_ONCE() in exit_io_context() which
triggers if !PF_EXITING.  All tasks hitting exit_io_context() from
task exit should have PF_EXITING set but task struct tearing down
after fork failure calls into the function without PF_EXITING,
triggering the condition.

  WARNING: at block/blk-ioc.c:234 exit_io_context+0x40/0x92()
  Pid: 17090, comm: trinity Not tainted 3.2.0-rc6-next-20111222-sasha-dirty #77
  Call Trace:
   [&lt;ffffffff810b69a3&gt;] warn_slowpath_common+0x8f/0xb2
   [&lt;ffffffff810b6a77&gt;] warn_slowpath_null+0x18/0x1a
   [&lt;ffffffff8181a7a2&gt;] exit_io_context+0x40/0x92
   [&lt;ffffffff810b58c9&gt;] copy_process+0x126f/0x1453
   [&lt;ffffffff810b5c1b&gt;] do_fork+0x120/0x3e9
   [&lt;ffffffff8106242f&gt;] sys_clone+0x26/0x28
   [&lt;ffffffff82425803&gt;] stub_clone+0x13/0x20
  ---[ end trace a2e4eb670b375238 ]---

Reported-by: Sasha Levin &lt;levinsasha928@gmail.com&gt;
Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
6e736be7 "block: make ioc get/put interface more conventional and fix
race on alloction" added WARN_ON_ONCE() in exit_io_context() which
triggers if !PF_EXITING.  All tasks hitting exit_io_context() from
task exit should have PF_EXITING set but task struct tearing down
after fork failure calls into the function without PF_EXITING,
triggering the condition.

  WARNING: at block/blk-ioc.c:234 exit_io_context+0x40/0x92()
  Pid: 17090, comm: trinity Not tainted 3.2.0-rc6-next-20111222-sasha-dirty #77
  Call Trace:
   [&lt;ffffffff810b69a3&gt;] warn_slowpath_common+0x8f/0xb2
   [&lt;ffffffff810b6a77&gt;] warn_slowpath_null+0x18/0x1a
   [&lt;ffffffff8181a7a2&gt;] exit_io_context+0x40/0x92
   [&lt;ffffffff810b58c9&gt;] copy_process+0x126f/0x1453
   [&lt;ffffffff810b5c1b&gt;] do_fork+0x120/0x3e9
   [&lt;ffffffff8106242f&gt;] sys_clone+0x26/0x28
   [&lt;ffffffff82425803&gt;] stub_clone+0x13/0x20
  ---[ end trace a2e4eb670b375238 ]---

Reported-by: Sasha Levin &lt;levinsasha928@gmail.com&gt;
Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>block: an exiting task should be allowed to create io_context</title>
<updated>2011-12-25T13:29:14+00:00</updated>
<author>
<name>Tejun Heo</name>
<email>tj@kernel.org</email>
</author>
<published>2011-12-25T13:29:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=fd63836811d6e5b5f5f608abf865bc9e91762c8c'/>
<id>fd63836811d6e5b5f5f608abf865bc9e91762c8c</id>
<content type='text'>
While fixing io_context creation / task exit race condition,
6e736be7f2 "block: make ioc get/put interface more conventional and
fix race on alloction" also prevented an exiting (%PF_EXITING) task
from creating its own io_context.  This is incorrect as exit path may
issue IOs, e.g. from exit_files(), and if those IOs are the first ones
issued by the task, io_context needs to be created to process the IOs.

Combined with the existing problem of io_context / io_cq creation
failure having the possibility of stalling IO, this problem results in
deterministic full IO lockup with certain workloads.

Fix it by allowing io_context creation regardless of %PF_EXITING for
%current.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Reported-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Reported-by: Hugh Dickins &lt;hughd@google.com&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
While fixing io_context creation / task exit race condition,
6e736be7f2 "block: make ioc get/put interface more conventional and
fix race on alloction" also prevented an exiting (%PF_EXITING) task
from creating its own io_context.  This is incorrect as exit path may
issue IOs, e.g. from exit_files(), and if those IOs are the first ones
issued by the task, io_context needs to be created to process the IOs.

Combined with the existing problem of io_context / io_cq creation
failure having the possibility of stalling IO, this problem results in
deterministic full IO lockup with certain workloads.

Fix it by allowing io_context creation regardless of %PF_EXITING for
%current.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Reported-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Reported-by: Hugh Dickins &lt;hughd@google.com&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>block: ioc_cgroup_changed() needs to be exported</title>
<updated>2011-12-19T09:36:44+00:00</updated>
<author>
<name>Jens Axboe</name>
<email>axboe@kernel.dk</email>
</author>
<published>2011-12-19T09:36:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=64c42998f14d5894ea3138625897d620b30c8e4e'/>
<id>64c42998f14d5894ea3138625897d620b30c8e4e</id>
<content type='text'>
With the ioc changed, ioc_cgroup_changed() can be used by modular
code. So ensure that it is exported.

Reported-by: Stephen Rothwell &lt;sfr@canb.auug.org.au&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
With the ioc changed, ioc_cgroup_changed() can be used by modular
code. So ensure that it is exported.

Reported-by: Stephen Rothwell &lt;sfr@canb.auug.org.au&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</pre>
</div>
</content>
</entry>
</feed>
