Re: [PATCH 01/45] writeback: reduce calls to global_page_state inbalance_dirty_pages()

From: Jan Kara
Date: Mon Oct 12 2009 - 17:19:31 EST


On Sun 11-10-09 05:33:39, Wu Fengguang wrote:
> On Fri, Oct 09, 2009 at 11:12:31PM +0800, Jan Kara wrote:
> > > + /* don't wait if we've done enough */
> > > + if (pages_written >= write_chunk)
> > > + break;
> > > }
> > > -
> > > - if (bdi_nr_reclaimable + bdi_nr_writeback <= bdi_thresh)
> > > - break;
> > > - if (pages_written >= write_chunk)
> > > - break; /* We've done our duty */
> > > -
> > Here, we had an opportunity to break from the loop even if we didn't
> > manage to write everything (for example because per-bdi thread managed to
> > write enough or because enough IO has completed while we were trying to
> > write). After the patch, we will sleep. IMHO that's not good...
>
> Note that the pages_written check is moved several lines up in the patch :)
>
> > I'd think that if we did all that work in writeback_inodes_wbc we could
> > spend the effort on regetting and rechecking the stats...
>
> Yes maybe. I didn't care it because the later throttle queue patch totally
> removed the loop and hence to need to reget the stats :)
Yes, since the loop gets removed in the end, this does not matter. You
are right.

> > > schedule_timeout_interruptible(pause);
> > >
> > > /*
> > > @@ -577,8 +547,7 @@ static void balance_dirty_pages(struct a
> > > pause = HZ / 10;
> > > }
> > >
> > > - if (bdi_nr_reclaimable + bdi_nr_writeback < bdi_thresh &&
> > > - bdi->dirty_exceeded)
> > > + if (!dirty_exceeded && bdi->dirty_exceeded)
> > > bdi->dirty_exceeded = 0;
> > Here we fail to clear dirty_exceeded if we are over global dirty limit
> > but not over per-bdi dirty limit...
>
> You must be mistaken: dirty_exceeded = (over bdi limit || over global limit),
> so !dirty_exceeded = (!over bdi limit && !over global limit).
Exactly. Previously, the check was:
if (!over bdi limit)
bdi->dirty_exceeded = 0;

Now it is
if (!over bdi limit && !over global limit)
bdi->dirty_exceeded = 0;

That's clearly not equivalent which is what I was trying to point out.
But looking at where dirty_exceeded is used, your new way is probably more
useful. It's just a bit counterintuitive that bdi->dirty_exceeded is set
even if the per-bdi limit is not exceeded...

Honza

--
Jan Kara <jack@xxxxxxx>
SUSE Labs, CR
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/