<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux.git/fs/aio.c, branch v3.19</title>
<subtitle>Linux kernel source tree</subtitle>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/'/>
<entry>
<title>aio: annotate aio_read_event_ring for sleep patterns</title>
<updated>2015-02-04T00:29:05+00:00</updated>
<author>
<name>Dave Chinner</name>
<email>dchinner@redhat.com</email>
</author>
<published>2015-02-04T00:29:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=9c9ce763b114e608b5cf3aa6cb69ad9f6e8b6adf'/>
<id>9c9ce763b114e608b5cf3aa6cb69ad9f6e8b6adf</id>
<content type='text'>
Under CONFIG_DEBUG_ATOMIC_SLEEP=y, aio_read_event_ring() will throw
warnings like the following due to being called from wait_event
context:

 WARNING: CPU: 0 PID: 16006 at kernel/sched/core.c:7300 __might_sleep+0x7f/0x90()
 do not call blocking ops when !TASK_RUNNING; state=1 set at [&lt;ffffffff810d85a3&gt;] prepare_to_wait_event+0x63/0x110
 Modules linked in:
 CPU: 0 PID: 16006 Comm: aio-dio-fcntl-r Not tainted 3.19.0-rc6-dgc+ #705
 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
  ffffffff821c0372 ffff88003c117cd8 ffffffff81daf2bd 000000000000d8d8
  ffff88003c117d28 ffff88003c117d18 ffffffff8109beda ffff88003c117cf8
  ffffffff821c115e 0000000000000061 0000000000000000 00007ffffe4aa300
 Call Trace:
  [&lt;ffffffff81daf2bd&gt;] dump_stack+0x4c/0x65
  [&lt;ffffffff8109beda&gt;] warn_slowpath_common+0x8a/0xc0
  [&lt;ffffffff8109bf56&gt;] warn_slowpath_fmt+0x46/0x50
  [&lt;ffffffff810d85a3&gt;] ? prepare_to_wait_event+0x63/0x110
  [&lt;ffffffff810d85a3&gt;] ? prepare_to_wait_event+0x63/0x110
  [&lt;ffffffff810bdfcf&gt;] __might_sleep+0x7f/0x90
  [&lt;ffffffff81db8344&gt;] mutex_lock+0x24/0x45
  [&lt;ffffffff81216b7c&gt;] aio_read_events+0x4c/0x290
  [&lt;ffffffff81216fac&gt;] read_events+0x1ec/0x220
  [&lt;ffffffff810d8650&gt;] ? prepare_to_wait_event+0x110/0x110
  [&lt;ffffffff810fdb10&gt;] ? hrtimer_get_res+0x50/0x50
  [&lt;ffffffff8121899d&gt;] SyS_io_getevents+0x4d/0xb0
  [&lt;ffffffff81dba5a9&gt;] system_call_fastpath+0x12/0x17
 ---[ end trace bde69eaf655a4fea ]---

There is not actually a bug here, so annotate the code to tell the
debug logic that everything is just fine and not to fire a false
positive.

Signed-off-by: Dave Chinner &lt;dchinner@redhat.com&gt;
Signed-off-by: Benjamin LaHaise &lt;bcrl@kvack.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Under CONFIG_DEBUG_ATOMIC_SLEEP=y, aio_read_event_ring() will throw
warnings like the following due to being called from wait_event
context:

 WARNING: CPU: 0 PID: 16006 at kernel/sched/core.c:7300 __might_sleep+0x7f/0x90()
 do not call blocking ops when !TASK_RUNNING; state=1 set at [&lt;ffffffff810d85a3&gt;] prepare_to_wait_event+0x63/0x110
 Modules linked in:
 CPU: 0 PID: 16006 Comm: aio-dio-fcntl-r Not tainted 3.19.0-rc6-dgc+ #705
 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
  ffffffff821c0372 ffff88003c117cd8 ffffffff81daf2bd 000000000000d8d8
  ffff88003c117d28 ffff88003c117d18 ffffffff8109beda ffff88003c117cf8
  ffffffff821c115e 0000000000000061 0000000000000000 00007ffffe4aa300
 Call Trace:
  [&lt;ffffffff81daf2bd&gt;] dump_stack+0x4c/0x65
  [&lt;ffffffff8109beda&gt;] warn_slowpath_common+0x8a/0xc0
  [&lt;ffffffff8109bf56&gt;] warn_slowpath_fmt+0x46/0x50
  [&lt;ffffffff810d85a3&gt;] ? prepare_to_wait_event+0x63/0x110
  [&lt;ffffffff810d85a3&gt;] ? prepare_to_wait_event+0x63/0x110
  [&lt;ffffffff810bdfcf&gt;] __might_sleep+0x7f/0x90
  [&lt;ffffffff81db8344&gt;] mutex_lock+0x24/0x45
  [&lt;ffffffff81216b7c&gt;] aio_read_events+0x4c/0x290
  [&lt;ffffffff81216fac&gt;] read_events+0x1ec/0x220
  [&lt;ffffffff810d8650&gt;] ? prepare_to_wait_event+0x110/0x110
  [&lt;ffffffff810fdb10&gt;] ? hrtimer_get_res+0x50/0x50
  [&lt;ffffffff8121899d&gt;] SyS_io_getevents+0x4d/0xb0
  [&lt;ffffffff81dba5a9&gt;] system_call_fastpath+0x12/0x17
 ---[ end trace bde69eaf655a4fea ]---

There is not actually a bug here, so annotate the code to tell the
debug logic that everything is just fine and not to fire a false
positive.

Signed-off-by: Dave Chinner &lt;dchinner@redhat.com&gt;
Signed-off-by: Benjamin LaHaise &lt;bcrl@kvack.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>aio: Skip timer for io_getevents if timeout=0</title>
<updated>2014-12-13T22:50:20+00:00</updated>
<author>
<name>Fam Zheng</name>
<email>famz@redhat.com</email>
</author>
<published>2014-11-06T12:44:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=5f785de588735306ec4d7c875caf9d28481c8b21'/>
<id>5f785de588735306ec4d7c875caf9d28481c8b21</id>
<content type='text'>
In this case, it is basically a polling. Let's not involve timer at all
because that would hurt performance for application event loops.

In an arbitrary test I've done, io_getevents syscall elapsed time
reduces from 50000+ nanoseconds to a few hundereds.

Signed-off-by: Fam Zheng &lt;famz@redhat.com&gt;
Signed-off-by: Benjamin LaHaise &lt;bcrl@kvack.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In this case, it is basically a polling. Let's not involve timer at all
because that would hurt performance for application event loops.

In an arbitrary test I've done, io_getevents syscall elapsed time
reduces from 50000+ nanoseconds to a few hundereds.

Signed-off-by: Fam Zheng &lt;famz@redhat.com&gt;
Signed-off-by: Benjamin LaHaise &lt;bcrl@kvack.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>aio: Make it possible to remap aio ring</title>
<updated>2014-12-13T22:49:50+00:00</updated>
<author>
<name>Pavel Emelyanov</name>
<email>xemul@parallels.com</email>
</author>
<published>2014-09-18T15:56:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=e4a0d3e720e7e508749c1439b5ba3aff56c92976'/>
<id>e4a0d3e720e7e508749c1439b5ba3aff56c92976</id>
<content type='text'>
There are actually two issues this patch addresses. Let me start with
the one I tried to solve in the beginning.

So, in the checkpoint-restore project (criu) we try to dump tasks'
state and restore one back exactly as it was. One of the tasks' state
bits is rings set up with io_setup() call. There's (almost) no problems
in dumping them, there's a problem restoring them -- if I dump a task
with aio ring originally mapped at address A, I want to restore one
back at exactly the same address A. Unfortunately, the io_setup() does
not allow for that -- it mmaps the ring at whatever place mm finds
appropriate (it calls do_mmap_pgoff() with zero address and without
the MAP_FIXED flag).

To make restore possible I'm going to mremap() the freshly created ring
into the address A (under which it was seen before dump). The problem is
that the ring's virtual address is passed back to the user-space as the
context ID and this ID is then used as search key by all the other io_foo()
calls. Reworking this ID to be just some integer doesn't seem to work, as
this value is already used by libaio as a pointer using which this library
accesses memory for aio meta-data.

So, to make restore work we need to make sure that

a) ring is mapped at desired virtual address
b) kioctx-&gt;user_id matches this value

Having said that, the patch makes mremap() on aio region update the
kioctx's user_id and mmap_base values.

Here appears the 2nd issue I mentioned in the beginning of this mail.
If (regardless of the C/R dances I do) someone creates an io context
with io_setup(), then mremap()-s the ring and then destroys the context,
the kill_ioctx() routine will call munmap() on wrong (old) address.
This will result in a) aio ring remaining in memory and b) some other
vma get unexpectedly unmapped.

What do you think?

Signed-off-by: Pavel Emelyanov &lt;xemul@parallels.com&gt;
Acked-by: Dmitry Monakhov &lt;dmonakhov@openvz.org&gt;
Signed-off-by: Benjamin LaHaise &lt;bcrl@kvack.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
There are actually two issues this patch addresses. Let me start with
the one I tried to solve in the beginning.

So, in the checkpoint-restore project (criu) we try to dump tasks'
state and restore one back exactly as it was. One of the tasks' state
bits is rings set up with io_setup() call. There's (almost) no problems
in dumping them, there's a problem restoring them -- if I dump a task
with aio ring originally mapped at address A, I want to restore one
back at exactly the same address A. Unfortunately, the io_setup() does
not allow for that -- it mmaps the ring at whatever place mm finds
appropriate (it calls do_mmap_pgoff() with zero address and without
the MAP_FIXED flag).

To make restore possible I'm going to mremap() the freshly created ring
into the address A (under which it was seen before dump). The problem is
that the ring's virtual address is passed back to the user-space as the
context ID and this ID is then used as search key by all the other io_foo()
calls. Reworking this ID to be just some integer doesn't seem to work, as
this value is already used by libaio as a pointer using which this library
accesses memory for aio meta-data.

So, to make restore work we need to make sure that

a) ring is mapped at desired virtual address
b) kioctx-&gt;user_id matches this value

Having said that, the patch makes mremap() on aio region update the
kioctx's user_id and mmap_base values.

Here appears the 2nd issue I mentioned in the beginning of this mail.
If (regardless of the C/R dances I do) someone creates an io context
with io_setup(), then mremap()-s the ring and then destroys the context,
the kill_ioctx() routine will call munmap() on wrong (old) address.
This will result in a) aio ring remaining in memory and b) some other
vma get unexpectedly unmapped.

What do you think?

Signed-off-by: Pavel Emelyanov &lt;xemul@parallels.com&gt;
Acked-by: Dmitry Monakhov &lt;dmonakhov@openvz.org&gt;
Signed-off-by: Benjamin LaHaise &lt;bcrl@kvack.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge git://git.kvack.org/~bcrl/aio-fixes</title>
<updated>2014-11-26T02:55:44+00:00</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2014-11-26T02:55:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=277f850fbc4a0c732311af2b9a2d28d29a3c5582'/>
<id>277f850fbc4a0c732311af2b9a2d28d29a3c5582</id>
<content type='text'>
Pull aio fix from Ben LaHaise:
 "Dirty page accounting fix for aio"

* git://git.kvack.org/~bcrl/aio-fixes:
  aio: fix uncorrent dirty pages accouting when truncating AIO ring buffer
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Pull aio fix from Ben LaHaise:
 "Dirty page accounting fix for aio"

* git://git.kvack.org/~bcrl/aio-fixes:
  aio: fix uncorrent dirty pages accouting when truncating AIO ring buffer
</pre>
</div>
</content>
</entry>
<entry>
<title>aio: fix uncorrent dirty pages accouting when truncating AIO ring buffer</title>
<updated>2014-11-06T19:27:19+00:00</updated>
<author>
<name>Gu Zheng</name>
<email>guz.fnst@cn.fujitsu.com</email>
</author>
<published>2014-11-06T09:46:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=835f252c6debd204fcd607c79975089b1ecd3472'/>
<id>835f252c6debd204fcd607c79975089b1ecd3472</id>
<content type='text'>
https://bugzilla.kernel.org/show_bug.cgi?id=86831

Markus reported that when shutting down mysqld (with AIO support,
on a ext3 formatted Harddrive) leads to a negative number of dirty pages
(underrun to the counter). The negative number results in a drastic reduction
of the write performance because the page cache is not used, because the kernel
thinks it is still 2 ^ 32 dirty pages open.

Add a warn trace in __dec_zone_state will catch this easily:

static inline void __dec_zone_state(struct zone *zone, enum
	zone_stat_item item)
{
     atomic_long_dec(&amp;zone-&gt;vm_stat[item]);
+    WARN_ON_ONCE(item == NR_FILE_DIRTY &amp;&amp;
	atomic_long_read(&amp;zone-&gt;vm_stat[item]) &lt; 0);
     atomic_long_dec(&amp;vm_stat[item]);
}

[   21.341632] ------------[ cut here ]------------
[   21.346294] WARNING: CPU: 0 PID: 309 at include/linux/vmstat.h:242
cancel_dirty_page+0x164/0x224()
[   21.355296] Modules linked in: wutbox_cp sata_mv
[   21.359968] CPU: 0 PID: 309 Comm: kworker/0:1 Not tainted 3.14.21-WuT #80
[   21.366793] Workqueue: events free_ioctx
[   21.370760] [&lt;c0016a64&gt;] (unwind_backtrace) from [&lt;c0012f88&gt;]
(show_stack+0x20/0x24)
[   21.378562] [&lt;c0012f88&gt;] (show_stack) from [&lt;c03f8ccc&gt;]
(dump_stack+0x24/0x28)
[   21.385840] [&lt;c03f8ccc&gt;] (dump_stack) from [&lt;c0023ae4&gt;]
(warn_slowpath_common+0x84/0x9c)
[   21.393976] [&lt;c0023ae4&gt;] (warn_slowpath_common) from [&lt;c0023bb8&gt;]
(warn_slowpath_null+0x2c/0x34)
[   21.402800] [&lt;c0023bb8&gt;] (warn_slowpath_null) from [&lt;c00c0688&gt;]
(cancel_dirty_page+0x164/0x224)
[   21.411524] [&lt;c00c0688&gt;] (cancel_dirty_page) from [&lt;c00c080c&gt;]
(truncate_inode_page+0x8c/0x158)
[   21.420272] [&lt;c00c080c&gt;] (truncate_inode_page) from [&lt;c00c0a94&gt;]
(truncate_inode_pages_range+0x11c/0x53c)
[   21.429890] [&lt;c00c0a94&gt;] (truncate_inode_pages_range) from
[&lt;c00c0f6c&gt;] (truncate_pagecache+0x88/0xac)
[   21.439252] [&lt;c00c0f6c&gt;] (truncate_pagecache) from [&lt;c00c0fec&gt;]
(truncate_setsize+0x5c/0x74)
[   21.447731] [&lt;c00c0fec&gt;] (truncate_setsize) from [&lt;c013b3a8&gt;]
(put_aio_ring_file.isra.14+0x34/0x90)
[   21.456826] [&lt;c013b3a8&gt;] (put_aio_ring_file.isra.14) from
[&lt;c013b424&gt;] (aio_free_ring+0x20/0xcc)
[   21.465660] [&lt;c013b424&gt;] (aio_free_ring) from [&lt;c013b4f4&gt;]
(free_ioctx+0x24/0x44)
[   21.473190] [&lt;c013b4f4&gt;] (free_ioctx) from [&lt;c003d8d8&gt;]
(process_one_work+0x134/0x47c)
[   21.481132] [&lt;c003d8d8&gt;] (process_one_work) from [&lt;c003e988&gt;]
(worker_thread+0x130/0x414)
[   21.489350] [&lt;c003e988&gt;] (worker_thread) from [&lt;c00448ac&gt;]
(kthread+0xd4/0xec)
[   21.496621] [&lt;c00448ac&gt;] (kthread) from [&lt;c000ec18&gt;]
(ret_from_fork+0x14/0x20)
[   21.503884] ---[ end trace 79c4bf42c038c9a1 ]---

The cause is that we set the aio ring file pages as *DIRTY* via SetPageDirty
(bypasses the VFS dirty pages increment) when init, and aio fs uses
*default_backing_dev_info* as the backing dev, which does not disable
the dirty pages accounting capability.
So truncating aio ring file will contribute to accounting dirty pages (VFS
dirty pages decrement), then error occurs.

The original goal is keeping these pages in memory (can not be reclaimed
or swapped) in life-time via marking it dirty. But thinking more, we have
already pinned pages via elevating the page's refcount, which can already
achieve the goal, so the SetPageDirty seems unnecessary.

In order to fix the issue, using the __set_page_dirty_no_writeback instead
of the nop .set_page_dirty, and dropped the SetPageDirty (don't manually
set the dirty flags, don't disable set_page_dirty(), rely on default behaviour).

With the above change, the dirty pages accounting can work well. But as we
known, aio fs is an anonymous one, which should never cause any real write-back,
we can ignore the dirty pages (write back) accounting by disabling the dirty
pages (write back) accounting capability. So we introduce an aio private
backing dev info (disabled the ACCT_DIRTY/WRITEBACK/ACCT_WB capabilities) to
replace the default one.

Reported-by: Markus Königshaus &lt;m.koenigshaus@wut.de&gt;
Signed-off-by: Gu Zheng &lt;guz.fnst@cn.fujitsu.com&gt;
Cc: stable &lt;stable@vger.kernel.org&gt;
Acked-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Benjamin LaHaise &lt;bcrl@kvack.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
https://bugzilla.kernel.org/show_bug.cgi?id=86831

Markus reported that when shutting down mysqld (with AIO support,
on a ext3 formatted Harddrive) leads to a negative number of dirty pages
(underrun to the counter). The negative number results in a drastic reduction
of the write performance because the page cache is not used, because the kernel
thinks it is still 2 ^ 32 dirty pages open.

Add a warn trace in __dec_zone_state will catch this easily:

static inline void __dec_zone_state(struct zone *zone, enum
	zone_stat_item item)
{
     atomic_long_dec(&amp;zone-&gt;vm_stat[item]);
+    WARN_ON_ONCE(item == NR_FILE_DIRTY &amp;&amp;
	atomic_long_read(&amp;zone-&gt;vm_stat[item]) &lt; 0);
     atomic_long_dec(&amp;vm_stat[item]);
}

[   21.341632] ------------[ cut here ]------------
[   21.346294] WARNING: CPU: 0 PID: 309 at include/linux/vmstat.h:242
cancel_dirty_page+0x164/0x224()
[   21.355296] Modules linked in: wutbox_cp sata_mv
[   21.359968] CPU: 0 PID: 309 Comm: kworker/0:1 Not tainted 3.14.21-WuT #80
[   21.366793] Workqueue: events free_ioctx
[   21.370760] [&lt;c0016a64&gt;] (unwind_backtrace) from [&lt;c0012f88&gt;]
(show_stack+0x20/0x24)
[   21.378562] [&lt;c0012f88&gt;] (show_stack) from [&lt;c03f8ccc&gt;]
(dump_stack+0x24/0x28)
[   21.385840] [&lt;c03f8ccc&gt;] (dump_stack) from [&lt;c0023ae4&gt;]
(warn_slowpath_common+0x84/0x9c)
[   21.393976] [&lt;c0023ae4&gt;] (warn_slowpath_common) from [&lt;c0023bb8&gt;]
(warn_slowpath_null+0x2c/0x34)
[   21.402800] [&lt;c0023bb8&gt;] (warn_slowpath_null) from [&lt;c00c0688&gt;]
(cancel_dirty_page+0x164/0x224)
[   21.411524] [&lt;c00c0688&gt;] (cancel_dirty_page) from [&lt;c00c080c&gt;]
(truncate_inode_page+0x8c/0x158)
[   21.420272] [&lt;c00c080c&gt;] (truncate_inode_page) from [&lt;c00c0a94&gt;]
(truncate_inode_pages_range+0x11c/0x53c)
[   21.429890] [&lt;c00c0a94&gt;] (truncate_inode_pages_range) from
[&lt;c00c0f6c&gt;] (truncate_pagecache+0x88/0xac)
[   21.439252] [&lt;c00c0f6c&gt;] (truncate_pagecache) from [&lt;c00c0fec&gt;]
(truncate_setsize+0x5c/0x74)
[   21.447731] [&lt;c00c0fec&gt;] (truncate_setsize) from [&lt;c013b3a8&gt;]
(put_aio_ring_file.isra.14+0x34/0x90)
[   21.456826] [&lt;c013b3a8&gt;] (put_aio_ring_file.isra.14) from
[&lt;c013b424&gt;] (aio_free_ring+0x20/0xcc)
[   21.465660] [&lt;c013b424&gt;] (aio_free_ring) from [&lt;c013b4f4&gt;]
(free_ioctx+0x24/0x44)
[   21.473190] [&lt;c013b4f4&gt;] (free_ioctx) from [&lt;c003d8d8&gt;]
(process_one_work+0x134/0x47c)
[   21.481132] [&lt;c003d8d8&gt;] (process_one_work) from [&lt;c003e988&gt;]
(worker_thread+0x130/0x414)
[   21.489350] [&lt;c003e988&gt;] (worker_thread) from [&lt;c00448ac&gt;]
(kthread+0xd4/0xec)
[   21.496621] [&lt;c00448ac&gt;] (kthread) from [&lt;c000ec18&gt;]
(ret_from_fork+0x14/0x20)
[   21.503884] ---[ end trace 79c4bf42c038c9a1 ]---

The cause is that we set the aio ring file pages as *DIRTY* via SetPageDirty
(bypasses the VFS dirty pages increment) when init, and aio fs uses
*default_backing_dev_info* as the backing dev, which does not disable
the dirty pages accounting capability.
So truncating aio ring file will contribute to accounting dirty pages (VFS
dirty pages decrement), then error occurs.

The original goal is keeping these pages in memory (can not be reclaimed
or swapped) in life-time via marking it dirty. But thinking more, we have
already pinned pages via elevating the page's refcount, which can already
achieve the goal, so the SetPageDirty seems unnecessary.

In order to fix the issue, using the __set_page_dirty_no_writeback instead
of the nop .set_page_dirty, and dropped the SetPageDirty (don't manually
set the dirty flags, don't disable set_page_dirty(), rely on default behaviour).

With the above change, the dirty pages accounting can work well. But as we
known, aio fs is an anonymous one, which should never cause any real write-back,
we can ignore the dirty pages (write back) accounting by disabling the dirty
pages (write back) accounting capability. So we introduce an aio private
backing dev info (disabled the ACCT_DIRTY/WRITEBACK/ACCT_WB capabilities) to
replace the default one.

Reported-by: Markus Königshaus &lt;m.koenigshaus@wut.de&gt;
Signed-off-by: Gu Zheng &lt;guz.fnst@cn.fujitsu.com&gt;
Cc: stable &lt;stable@vger.kernel.org&gt;
Acked-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Benjamin LaHaise &lt;bcrl@kvack.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>percpu_ref: add PERCPU_REF_INIT_* flags</title>
<updated>2014-09-24T17:31:50+00:00</updated>
<author>
<name>Tejun Heo</name>
<email>tj@kernel.org</email>
</author>
<published>2014-09-24T17:31:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=2aad2a86f6685c10360ec8a5a55eb9ab7059cb72'/>
<id>2aad2a86f6685c10360ec8a5a55eb9ab7059cb72</id>
<content type='text'>
With the recent addition of percpu_ref_reinit(), percpu_ref now can be
used as a persistent switch which can be turned on and off repeatedly
where turning off maps to killing the ref and waiting for it to drain;
however, there currently isn't a way to initialize a percpu_ref in its
off (killed and drained) state, which can be inconvenient for certain
persistent switch use cases.

Similarly, percpu_ref_switch_to_atomic/percpu() allow dynamic
selection of operation mode; however, currently a newly initialized
percpu_ref is always in percpu mode making it impossible to avoid the
latency overhead of switching to atomic mode.

This patch adds @flags to percpu_ref_init() and implements the
following flags.

* PERCPU_REF_INIT_ATOMIC	: start ref in atomic mode
* PERCPU_REF_INIT_DEAD		: start ref killed and drained

These flags should be able to serve the above two use cases.

v2: target_core_tpg.c conversion was missing.  Fixed.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Reviewed-by: Kent Overstreet &lt;kmo@daterainc.com&gt;
Cc: Jens Axboe &lt;axboe@kernel.dk&gt;
Cc: Christoph Hellwig &lt;hch@infradead.org&gt;
Cc: Johannes Weiner &lt;hannes@cmpxchg.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
With the recent addition of percpu_ref_reinit(), percpu_ref now can be
used as a persistent switch which can be turned on and off repeatedly
where turning off maps to killing the ref and waiting for it to drain;
however, there currently isn't a way to initialize a percpu_ref in its
off (killed and drained) state, which can be inconvenient for certain
persistent switch use cases.

Similarly, percpu_ref_switch_to_atomic/percpu() allow dynamic
selection of operation mode; however, currently a newly initialized
percpu_ref is always in percpu mode making it impossible to avoid the
latency overhead of switching to atomic mode.

This patch adds @flags to percpu_ref_init() and implements the
following flags.

* PERCPU_REF_INIT_ATOMIC	: start ref in atomic mode
* PERCPU_REF_INIT_DEAD		: start ref killed and drained

These flags should be able to serve the above two use cases.

v2: target_core_tpg.c conversion was missing.  Fixed.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Reviewed-by: Kent Overstreet &lt;kmo@daterainc.com&gt;
Cc: Jens Axboe &lt;axboe@kernel.dk&gt;
Cc: Christoph Hellwig &lt;hch@infradead.org&gt;
Cc: Johannes Weiner &lt;hannes@cmpxchg.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block into for-3.18</title>
<updated>2014-09-24T17:00:21+00:00</updated>
<author>
<name>Tejun Heo</name>
<email>tj@kernel.org</email>
</author>
<published>2014-09-24T17:00:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=d06efebf0c37d438fcf07057be00dd40fcfce08d'/>
<id>d06efebf0c37d438fcf07057be00dd40fcfce08d</id>
<content type='text'>
This is to receive 0a30288da1ae ("blk-mq, percpu_ref: implement a
kludge for SCSI blk-mq stall during probe") which implements
__percpu_ref_kill_expedited() to work around SCSI blk-mq stall.  The
commit reverted and patches to implement proper fix will be added.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Cc: Kent Overstreet &lt;kmo@daterainc.com&gt;
Cc: Jens Axboe &lt;axboe@kernel.dk&gt;
Cc: Christoph Hellwig &lt;hch@lst.de&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This is to receive 0a30288da1ae ("blk-mq, percpu_ref: implement a
kludge for SCSI blk-mq stall during probe") which implements
__percpu_ref_kill_expedited() to work around SCSI blk-mq stall.  The
commit reverted and patches to implement proper fix will be added.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Cc: Kent Overstreet &lt;kmo@daterainc.com&gt;
Cc: Jens Axboe &lt;axboe@kernel.dk&gt;
Cc: Christoph Hellwig &lt;hch@lst.de&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>percpu-refcount: add @gfp to percpu_ref_init()</title>
<updated>2014-09-08T00:51:30+00:00</updated>
<author>
<name>Tejun Heo</name>
<email>tj@kernel.org</email>
</author>
<published>2014-09-08T00:51:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=a34375ef9e65340a138fc0be287de5c940d260fc'/>
<id>a34375ef9e65340a138fc0be287de5c940d260fc</id>
<content type='text'>
Percpu allocator now supports allocation mask.  Add @gfp to
percpu_ref_init() so that !GFP_KERNEL allocation masks can be used
with percpu_refs too.

This patch doesn't make any functional difference.

v2: blk-mq conversion was missing.  Updated.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Cc: Kent Overstreet &lt;koverstreet@google.com&gt;
Cc: Benjamin LaHaise &lt;bcrl@kvack.org&gt;
Cc: Li Zefan &lt;lizefan@huawei.com&gt;
Cc: Nicholas A. Bellinger &lt;nab@linux-iscsi.org&gt;
Cc: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Percpu allocator now supports allocation mask.  Add @gfp to
percpu_ref_init() so that !GFP_KERNEL allocation masks can be used
with percpu_refs too.

This patch doesn't make any functional difference.

v2: blk-mq conversion was missing.  Updated.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Cc: Kent Overstreet &lt;koverstreet@google.com&gt;
Cc: Benjamin LaHaise &lt;bcrl@kvack.org&gt;
Cc: Li Zefan &lt;lizefan@huawei.com&gt;
Cc: Nicholas A. Bellinger &lt;nab@linux-iscsi.org&gt;
Cc: Jens Axboe &lt;axboe@kernel.dk&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>aio: block exit_aio() until all context requests are completed</title>
<updated>2014-09-04T20:54:47+00:00</updated>
<author>
<name>Gu Zheng</name>
<email>guz.fnst@cn.fujitsu.com</email>
</author>
<published>2014-09-03T09:45:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=6098b45b32e6baeacc04790773ced9340601d511'/>
<id>6098b45b32e6baeacc04790773ced9340601d511</id>
<content type='text'>
It seems that exit_aio() also needs to wait for all iocbs to complete (like
io_destroy), but we missed the wait step in current implemention, so fix
it in the same way as we did in io_destroy.

Signed-off-by: Gu Zheng &lt;guz.fnst@cn.fujitsu.com&gt;
Signed-off-by: Benjamin LaHaise &lt;bcrl@kvack.org&gt;
Cc: stable@vger.kernel.org
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
It seems that exit_aio() also needs to wait for all iocbs to complete (like
io_destroy), but we missed the wait step in current implemention, so fix
it in the same way as we did in io_destroy.

Signed-off-by: Gu Zheng &lt;guz.fnst@cn.fujitsu.com&gt;
Signed-off-by: Benjamin LaHaise &lt;bcrl@kvack.org&gt;
Cc: stable@vger.kernel.org
</pre>
</div>
</content>
</entry>
<entry>
<title>aio: add missing smp_rmb() in read_events_ring</title>
<updated>2014-09-02T19:20:03+00:00</updated>
<author>
<name>Jeff Moyer</name>
<email>jmoyer@redhat.com</email>
</author>
<published>2014-09-02T17:17:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=2ff396be602f10b5eab8e73b24f20348fa2de159'/>
<id>2ff396be602f10b5eab8e73b24f20348fa2de159</id>
<content type='text'>
We ran into a case on ppc64 running mariadb where io_getevents would
return zeroed out I/O events.  After adding instrumentation, it became
clear that there was some missing synchronization between reading the
tail pointer and the events themselves.  This small patch fixes the
problem in testing.

Thanks to Zach for helping to look into this, and suggesting the fix.

Signed-off-by: Jeff Moyer &lt;jmoyer@redhat.com&gt;
Signed-off-by: Benjamin LaHaise &lt;bcrl@kvack.org&gt;
Cc: stable@vger.kernel.org
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We ran into a case on ppc64 running mariadb where io_getevents would
return zeroed out I/O events.  After adding instrumentation, it became
clear that there was some missing synchronization between reading the
tail pointer and the events themselves.  This small patch fixes the
problem in testing.

Thanks to Zach for helping to look into this, and suggesting the fix.

Signed-off-by: Jeff Moyer &lt;jmoyer@redhat.com&gt;
Signed-off-by: Benjamin LaHaise &lt;bcrl@kvack.org&gt;
Cc: stable@vger.kernel.org
</pre>
</div>
</content>
</entry>
</feed>
