All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <jens.axboe@oracle.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	chris.mason@oracle.com, david@fromorbit.com, tytso@mit.edu,
	akpm@linux-foundation.org, jack@suse.cz
Subject: Re: [PATCH 2/8] writeback: move dirty inodes from super_block to backing_dev_info
Date: Fri, 11 Sep 2009 09:47:23 +0200	[thread overview]
Message-ID: <20090911074723.GF18599@kernel.dk> (raw)
In-Reply-To: <20090908184442.GB5956@infradead.org>

On Tue, Sep 08 2009, Christoph Hellwig wrote:
> On Sun, Sep 06, 2009 at 08:43:59PM +0200, Jens Axboe wrote:
> > On Fri, Sep 04 2009, Christoph Hellwig wrote:
> > > On Fri, Sep 04, 2009 at 08:53:57AM +0200, Jens Axboe wrote:
> > > > > +	if (wbc->sync_mode == WB_SYNC_ALL)
> > > > > +		bdi_wait_on_work_clear(&work);
> > > > >  }
> > > > 
> > > > That doesn't work, you have to wait for on-stack work. So either we just
> > > > punt and not do anything for WB_SYNC_NONE if the allocation fails, or we
> > > > punt to stack and do the wait. Since it's a cleaning action and
> > > > allocation fails, falling back to the stack and waiting seems like the
> > > > most appropriate choice.
> > > 
> > > True, the wait needs to be unconditional.  Updated version below.
> > 
> > (did you forget that patch? it's not there).
> 
> Here we go, sorry:

I have applied this to a postmerge writeback branch. I made one change,
though:

> +	if (wbc->sync_mode != WB_SYNC_ALL) {
> +		struct bdi_work *w = bdi_alloc_work(wbc);
> +		if (w) {
> +			bdi_queue_work(wbc->bdi, w);
> +			return;
> +		}

We should make that bdi_queue_work() unconditional, if you want to make
sure that we current thread wakes up and actually flushes some old data
when allocation fails.

void bdi_start_writeback(struct writeback_control *wbc)
{
        /*
         * WB_SYNC_NONE is opportunistic writeback. If this allocation fails,
         * bdi_queue_work() will wake up the thread and flush old data. This
         * should ensure some amount of progress in freeing memory.
         */
        if (wbc->sync_mode != WB_SYNC_ALL) {
                struct bdi_work *w = bdi_alloc_work(wbc);

                bdi_queue_work(wbc->bdi, w);
        } else {
                struct bdi_work work;

                bdi_work_init(&work, wbc);
                work.state |= WS_ONSTACK;

                bdi_queue_work(wbc->bdi, &work);
                bdi_wait_on_work_clear(&work);
        }
}

-- 
Jens Axboe


  reply	other threads:[~2009-09-11  7:47 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-02  8:42 [PATCH 0/8] Per-bdi writeback flusher threads v17 Jens Axboe
2009-09-02  8:42 ` [PATCH 1/8] writeback: get rid of generic_sync_sb_inodes() export Jens Axboe
2009-09-02 10:13   ` Jan Kara
2009-09-02 10:26     ` Jens Axboe
2009-09-02 14:01       ` Jan Kara
2009-09-02  8:42 ` [PATCH 2/8] writeback: move dirty inodes from super_block to backing_dev_info Jens Axboe
2009-09-04  2:46   ` Christoph Hellwig
2009-09-04  2:50     ` Christoph Hellwig
2009-09-04  7:19       ` Jens Axboe
2009-09-04  2:56   ` Christoph Hellwig
2009-09-04  6:53     ` Jens Axboe
2009-09-04 15:43       ` Christoph Hellwig
2009-09-06 18:43         ` Jens Axboe
2009-09-08 18:44           ` Christoph Hellwig
2009-09-11  7:47             ` Jens Axboe [this message]
2009-09-02  8:42 ` [PATCH 3/8] writeback: switch to per-bdi threads for flushing data Jens Axboe
2009-09-02  8:42 ` [PATCH 4/8] writeback: get rid of pdflush completely Jens Axboe
2009-09-02  8:42 ` [PATCH 5/8] writeback: add some debug inode list counters to bdi stats Jens Axboe
2009-09-02  8:42 ` [PATCH 6/8] writeback: add name to backing_dev_info Jens Axboe
2009-09-02  8:42 ` [PATCH 7/8] writeback: check for registered bdi in flusher add and inode dirty Jens Axboe
2009-09-02  8:42 ` [PATCH 8/8] vm: Add an tuning knob for vm.max_writeback_pages Jens Axboe
  -- strict thread matches above, loose matches on Subject: below --
2009-09-08  9:23 [PATCH 0/8] Per-bdi writeback flusher threads v19 Jens Axboe
2009-09-08  9:23 ` [PATCH 2/8] writeback: move dirty inodes from super_block to backing_dev_info Jens Axboe
2009-09-04  7:46 [PATCH 0/8] Per-bdi writeback flusher threads v18 Jens Axboe
2009-09-04  7:46 ` [PATCH 2/8] writeback: move dirty inodes from super_block to backing_dev_info Jens Axboe
2009-09-01 11:18 [PATCH 0/8] Per-bdi writeback flusher threads v16 Jens Axboe
2009-09-01 11:19 ` [PATCH 2/8] writeback: move dirty inodes from super_block to backing_dev_info Jens Axboe

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=20090911074723.GF18599@kernel.dk \
    --to=jens.axboe@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=chris.mason@oracle.com \
    --cc=david@fromorbit.com \
    --cc=hch@infradead.org \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tytso@mit.edu \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.