Skip to content

Commit

Permalink
mm: Make task in balance_dirty_pages() killable
Browse files Browse the repository at this point in the history
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 <k-mio@sx.jp.nec.com>
Tested-by: Kazuya Mio <k-mio@sx.jp.nec.com>
Reviewed-by: Neil Brown <neilb@suse.de>
Reviewed-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
  • Loading branch information
Jan Kara authored and Wu Fengguang committed Nov 16, 2011
1 parent 6aaf05f commit 499d05e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion mm/page-writeback.c
Original file line number Diff line number Diff line change
Expand Up @@ -1133,7 +1133,7 @@ static void balance_dirty_pages(struct address_space *mapping,
pages_dirtied,
pause,
start_time);
__set_current_state(TASK_UNINTERRUPTIBLE);
__set_current_state(TASK_KILLABLE);
io_schedule_timeout(pause);

dirty_thresh = hard_dirty_limit(dirty_thresh);
Expand All @@ -1145,6 +1145,9 @@ static void balance_dirty_pages(struct address_space *mapping,
*/
if (nr_dirty < dirty_thresh)
break;

if (fatal_signal_pending(current))
break;
}

if (!dirty_exceeded && bdi->dirty_exceeded)
Expand Down

0 comments on commit 499d05e

Please sign in to comment.