From: Jan Kara <jack@suse.cz>
To: Wu Fengguang <fengguang.wu@intel.com>
Cc: Jan Kara <jack@suse.cz>,
Andrew Morton <akpm@linux-foundation.org>,
Christoph Hellwig <hch@infradead.org>,
Al Viro <viro@ZenIV.linux.org.uk>,
"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>
Subject: Re: [PATCH 1/2] mm: Make task in balance_dirty_pages() killable
Date: Tue, 15 Nov 2011 15:44:52 +0100 [thread overview]
Message-ID: <20111115144452.GA25269@quack.suse.cz> (raw)
In-Reply-To: <20111115141528.GB25196@localhost>
On Tue 15-11-11 22:15:28, Wu Fengguang wrote:
> On Tue, Nov 15, 2011 at 09:41:27PM +0800, Jan Kara wrote:
> > On Tue 15-11-11 19:48:44, Wu Fengguang wrote:
> > > > +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.
> > Sorry, but I fail to see what would this bring us... Can you elaborate a
> > bit please?
>
> It's not bringing us something, but allows us to get rid of patch 2
> as well as adding fatal_signal_pending() tests to all the other fs.
>
> So no more worries about partial writes :)
>
> Sure it leaves ->write_begin() blocks unhandled, however that should
> be much less a problem than the blocks inside balance_dirty_pages().
Ah, OK, I see. Frankly, I'd rather keep the loop break in
generic_perform_write() and have the code straightforward. I don't see any
security (data exposure) problem there and if someone complains on the
grounds that the behavior has changed, we can revert the change in the
worst case.
Honza
--
Jan Kara <jack@suse.cz>
SUSE Labs, CR
next prev parent reply other threads:[~2011-11-15 14:45 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-14 16:15 [PATCH 0/2 v2] Make task in balance_dirty_pages() killable Jan Kara
2011-11-14 16:15 ` [PATCH 1/2] mm: " Jan Kara
2011-11-14 16:23 ` Christoph Hellwig
2011-11-15 11:48 ` Wu Fengguang
2011-11-15 13:41 ` Jan Kara
2011-11-15 14:15 ` Wu Fengguang
2011-11-15 14:44 ` Jan Kara [this message]
2011-11-14 16:15 ` [PATCH 2/2] fs: Make write(2) interruptible by a signal Jan Kara
2011-11-14 16:26 ` Christoph Hellwig
2011-11-14 16:46 ` Jan Kara
2011-11-14 20:13 ` Christoph Hellwig
2011-11-14 22:19 ` Andrew Morton
2011-11-15 11:23 ` Jan Kara
-- strict thread matches above, loose matches on Subject: below --
2011-11-16 11:12 [PATCH 0/2 v3] Make task in balance_dirty_pages() killable Jan Kara
2011-11-16 11:12 ` [PATCH 1/2] mm: " Jan Kara
2011-11-16 11:28 ` Wu Fengguang
2011-11-16 12:58 ` Jan Kara
2011-11-14 11:10 [PATCH 0/2] Make task doing heavy writing killable Jan Kara
2011-11-14 11:10 ` [PATCH 1/2] mm: Make task in balance_dirty_pages() killable Jan Kara
2011-11-14 12:12 ` Wu Fengguang
2011-11-14 12:37 ` Jan Kara
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20111115144452.GA25269@quack.suse.cz \
--to=jack@suse.cz \
--cc=akpm@linux-foundation.org \
--cc=fengguang.wu@intel.com \
--cc=hch@infradead.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=viro@ZenIV.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).