Skip to content

Commit 499d05e

Browse files
jankaraWu Fengguang
authored andcommitted
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 <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>
1 parent 6aaf05f commit 499d05e

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

‎mm/page-writeback.c‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1133,7 +1133,7 @@ static void balance_dirty_pages(struct address_space *mapping,
11331133
pages_dirtied,
11341134
pause,
11351135
start_time);
1136-
__set_current_state(TASK_UNINTERRUPTIBLE);
1136+
__set_current_state(TASK_KILLABLE);
11371137
io_schedule_timeout(pause);
11381138

11391139
dirty_thresh = hard_dirty_limit(dirty_thresh);
@@ -1145,6 +1145,9 @@ static void balance_dirty_pages(struct address_space *mapping,
11451145
*/
11461146
if (nr_dirty < dirty_thresh)
11471147
break;
1148+
1149+
if (fatal_signal_pending(current))
1150+
break;
11481151
}
11491152

11501153
if (!dirty_exceeded && bdi->dirty_exceeded)

0 commit comments

Comments
 (0)