[Devel] [PATCH RHEL7 COMMIT] ve/vmscan: do not throttle kthreads due to too_many_isolated
Konstantin Khorenko
khorenko at virtuozzo.com
Mon Dec 28 02:50:01 PST 2015
The commit is pushed to "branch-rh7-3.10.0-229.7.2.vz7.9.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-229.7.2.vz7.9.17
------>
commit 32d4b5770ae4c7431554f7602d67999394553452
Author: Vladimir Davydov <vdavydov at virtuozzo.com>
Date: Mon Dec 28 14:50:01 2015 +0400
ve/vmscan: do not throttle kthreads due to too_many_isolated
Ploop hands off bio processing to its kernel thread. This might result
to a dead lock as described below:
1. Several processes performing memcg reclaim isolate a bunch of
reclaimable pages and all get stuck in shrink_page_list waiting for
a page writeback to finish. Page writeback is up to ploop.
2. Ploop thread tries to allocate some memory and gets stuck in
shrink_inactive_list waiting for too_many_isolated to return false.
The latter will never happen, because the pages were isolated by
processes at step 1 waiting for ploop to complete page writeback.
PID: 44857 TASK: ffff880020bbf1a0 CPU: 1 COMMAND: "ploop37460"
[ffff880079b67228] schedule at ffffffff81607579
[ffff880079b67238] schedule_timeout at ffffffff81605365
[ffff880079b67270] process_timeout at ffffffff81080d10
[ffff880079b672e0] io_schedule_timeout at ffffffff81606c6b
[ffff880079b67310] congestion_wait at ffffffff8118ad32
[ffff880079b67328] autoremove_wake_function at ffffffff8109b640
[ffff880079b67370] shrink_inactive_list at ffffffff8117f7ec
[ffff880079b67388] radix_tree_delete_item at ffffffff812d9b76
[ffff880079b67458] shrink_lruvec at ffffffff811800f5
[ffff880079b67560] shrink_zone at ffffffff811806b1
[ffff880079b675f0] do_try_to_free_pages at ffffffff81180c20
[ffff880079b67690] try_to_free_pages at ffffffff811810b5
[ffff880079b67720] __alloc_pages_nodemask at ffffffff81174c17
[ffff880079b67860] alloc_pages_current at ffffffff811b8339
[ffff880079b678a8] new_slab at ffffffff811c4273
[ffff880079b678e8] __slab_alloc at ffffffff815ffeca
[ffff880079b67928] __radix_tree_preload at ffffffff812d859c
[ffff880079b67980] __mem_cgroup_commit_charge at ffffffff811d5c42
[ffff880079b679c0] kmem_cache_alloc at ffffffff811c6e8c
[ffff880079b679c8] __radix_tree_preload at ffffffff812d859c
[ffff880079b67a00] __radix_tree_preload at ffffffff812d859c
[ffff880079b67a28] radix_tree_maybe_preload at ffffffff812d8659
[ffff880079b67a38] __add_to_page_cache_locked at ffffffff8116a57b
[ffff880079b67a90] add_to_page_cache_lru at ffffffff8116a7b7
[ffff880079b67ac0] grab_cache_page_write_begin at ffffffff8116ac0f
[ffff880079b67b00] ext4_da_write_begin at ffffffffa0301054 [ext4]
[ffff880079b67b80] pagecache_write_begin at ffffffff81168f1c
[ffff880079b67b98] cached_submit at ffffffffa03e432b [pio_direct]
[ffff880079b67c80] dio_submit_alloc at ffffffffa03e5866 [pio_direct]
[ffff880079b67ca0] dio_submit at ffffffffa03e4eef [pio_direct]
[ffff880079b67d20] ploop1_allocate at ffffffffa03ddafc [pfmt_ploop1]
[ffff880079b67d38] ploop_entry_request at ffffffffa03b9be4 [ploop]
[ffff880079b67db8] ploop_req_state_process at ffffffffa03ba56d [ploop]
[ffff880079b67dd8] autoremove_wake_function at ffffffff8109b640
[ffff880079b67e28] ploop_thread at ffffffffa03baf13 [ploop]
[ffff880079b67ea8] ploop_thread at ffffffffa03bad60 [ploop]
[ffff880079b67ec8] kthread at ffffffff8109a4df
[ffff880079b67f30] kthread at ffffffff8109a410
[ffff880079b67f50] ret_from_fork at ffffffff81612058
[ffff880079b67f80] kthread at ffffffff8109a410
Fix this by omitting the too_many_isolated check for kernel threads.
This sounds reasonable not only for ploop kthread, because any kthread
might be responsible for reclaimer progress and therefore should not be
throttled by it.
https://jira.sw.ru/browse/PSBM-41410
Signed-off-by: Vladimir Davydov <vdavydov at virtuozzo.com>
Acked-by: Dmitry Monakhov <dmonakhov at openvz.org>
---
mm/vmscan.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/vmscan.c b/mm/vmscan.c
index eadc08b..3b96a02 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -1426,7 +1426,7 @@ static int __too_many_isolated(struct zone *zone, int file,
static int too_many_isolated(struct zone *zone, int file,
struct scan_control *sc)
{
- if (current_is_kswapd())
+ if (current->flags & PF_KTHREAD)
return 0;
if (!global_reclaim(sc))
More information about the Devel
mailing list