From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wu Fengguang Subject: Re: [PATCH 1/2] mm: Make task in balance_dirty_pages() killable Date: Tue, 15 Nov 2011 19:48:44 +0800 Message-ID: <20111115114844.GA11665@localhost> References: <1321287324-15121-1-git-send-email-jack@suse.cz> <1321287324-15121-2-git-send-email-jack@suse.cz> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Andrew Morton , Christoph Hellwig , Al Viro , "linux-fsdevel@vger.kernel.org" To: Jan Kara Return-path: Received: from mga03.intel.com ([143.182.124.21]:1683 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753227Ab1KOLst (ORCPT ); Tue, 15 Nov 2011 06:48:49 -0500 Content-Disposition: inline In-Reply-To: <1321287324-15121-2-git-send-email-jack@suse.cz> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: > +static int balance_dirty_pages(struct address_space *mapping, > unsigned long pages_dirtied) > { > unsigned long nr_reclaimable; /* = file_dirty + unstable_nfs */ > @@ -1020,6 +1023,7 @@ static void balance_dirty_pages(struct address_space *mapping, > unsigned long pos_ratio; > struct backing_dev_info *bdi = mapping->backing_dev_info; > unsigned long start_time = jiffies; > + int err = 0; > > for (;;) { > /* > @@ -1133,7 +1137,7 @@ pause: > 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); > @@ -1145,6 +1149,11 @@ pause: > */ > if (nr_dirty < dirty_thresh) > break; > + > + if (fatal_signal_pending(current)) { > + err = -EINTR; > + break; > + } > } The other alternative is to raise the limit on fatal_signal_pending: if (fatal_signal_pending(current) && nr_dirty < dirty_thresh + dirty_thresh / 2) break; That should work well enough in practice and avoids touching the fs code. Thanks, Fengguang