Commit 499d05ec authored by Jan Kara's avatar Jan Kara Committed by Wu Fengguang

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: default avatarKazuya Mio <k-mio@sx.jp.nec.com>
Tested-by: default avatarKazuya Mio <k-mio@sx.jp.nec.com>
Reviewed-by: default avatarNeil Brown <neilb@suse.de>
Reviewed-by: default avatarKOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Signed-off-by: default avatarJan Kara <jack@suse.cz>
Signed-off-by: default avatarWu Fengguang <fengguang.wu@intel.com>
parent 6aaf05f4
...@@ -1133,7 +1133,7 @@ static void balance_dirty_pages(struct address_space *mapping, ...@@ -1133,7 +1133,7 @@ static void balance_dirty_pages(struct address_space *mapping,
pages_dirtied, pages_dirtied,
pause, pause,
start_time); start_time);
__set_current_state(TASK_UNINTERRUPTIBLE); __set_current_state(TASK_KILLABLE);
io_schedule_timeout(pause); io_schedule_timeout(pause);
dirty_thresh = hard_dirty_limit(dirty_thresh); dirty_thresh = hard_dirty_limit(dirty_thresh);
...@@ -1145,6 +1145,9 @@ static void balance_dirty_pages(struct address_space *mapping, ...@@ -1145,6 +1145,9 @@ static void balance_dirty_pages(struct address_space *mapping,
*/ */
if (nr_dirty < dirty_thresh) if (nr_dirty < dirty_thresh)
break; break;
if (fatal_signal_pending(current))
break;
} }
if (!dirty_exceeded && bdi->dirty_exceeded) if (!dirty_exceeded && bdi->dirty_exceeded)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment