From: Jan Kara Date: Wed, 16 Nov 2011 11:34:48 +0000 (+0800) Subject: mm: Make task in balance_dirty_pages() killable X-Git-Tag: v2.6.39-400.9.0~565^2~2^2~2 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=96e57e53a470b428a332cd298cac933f2c91d9f6;p=users%2Fjedix%2Flinux-maple.git mm: Make task in balance_dirty_pages() killable There is no reason why task in balance_dirty_pages() shouldn't be killable and it helps in recovering from some error conditions (like when filesystem goes in error state and cannot accept writeback anymore but we still want to kill processes using it to be able to unmount it). There will be follow up patches to further abort the generic_perform_write() and other filesystem write loops, to avoid large write + SIGKILL combination exceeding the dirty limit and possibly strange OOM. Reported-by: Kazuya Mio Tested-by: Kazuya Mio Reviewed-by: Neil Brown Reviewed-by: KOSAKI Motohiro Signed-off-by: Jan Kara Signed-off-by: Wu Fengguang --- diff --git a/mm/page-writeback.c b/mm/page-writeback.c index 955fe35d01e05..8e8f3afeb6aea 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c @@ -566,7 +566,7 @@ static void balance_dirty_pages(struct address_space *mapping, break; /* We've done our duty */ } trace_wbc_balance_dirty_wait(&wbc, bdi); - __set_current_state(TASK_UNINTERRUPTIBLE); + __set_current_state(TASK_KILLABLE); io_schedule_timeout(pause); /* @@ -576,6 +576,9 @@ static void balance_dirty_pages(struct address_space *mapping, pause <<= 1; if (pause > HZ / 10) pause = HZ / 10; + + if (fatal_signal_pending(current)) + break; } if (!dirty_exceeded && bdi->dirty_exceeded)