Re: [RFC PATCH 0/6] Do not call ->writepage[s] from direct reclaim and use a_ops->writepages() where possible

Mel Gorman
2010-06-15T16:34:27Z

> > > That is pretty much what Dave is claiming here at
> > > http://lkml.org/lkml/2010/4/13/121 where if mempool_alloc_slab() needed
> >
> > This stack trace shows writepage called by shrink_page_list... that
> > contradict Christoph's claim that xfs already won't writepage if
> > invoked by direct reclaim.
> >
>
> See this
>
> STATIC int
> xfs_vm_writepage(
> struct page *page,
> struct writeback_control *wbc)
> {
> int error;
> int need_trans;
> int delalloc, unmapped, unwritten;
> struct inode *inode = page->mapping->host;
>
> trace_xfs_writepage(inode, page, 0);
>
> /*
> * Refuse to write the page out if we are called from reclaim
> * context.
> *
> * This is primarily to avoid stack overflows when called from deep
> * used stacks in random callers for direct reclaim, but disabling
> * reclaim for kswap is a nice side-effect as kswapd causes rather
> * suboptimal I/O patters, too.
> *
> * This should really be done by the core VM, but until that happens
> * filesystems like XFS, btrfs and ext4 have to take care of this
> * by themselves.
> */
> if (current->flags & PF_MEMALLOC)
> goto out_fail;
>

My apologies. I didn't realise this was added so recently. I thought for
a while already so....

> > Not bad at all... throttling is what makes it safe too. Problem is all
> > the rest that isn't solved by this and could be solved with a stack
> > switch, that's my main reason for considering this a ->writepage only
> > hack not complete enough to provide a generic solution for reclaim
> > issues ending up in fs->dm->iscsi/bio. I also suspect xfs is more hog
> > than others (might not be a coicidence the 7k happens with xfs
> > writepage) and could be lightened up a bit by looking into it.
> >
>
> Other than the whole "lacking the code" thing and it's still not clear that
> writing from direct reclaim is absolutly necessary for VM stability considering
> it's been ignored today by at least two filesystems.

I retract this point as well because in reality, we have little data on
the full consequences of not writing pages from direct reclaim. Early
data based on the tests I've run indicate that the number of pages
direct reclaim writes is so small that it's not a problem but there is a
strong case for adding throttling at least.

--
Mel Gorman
Part-time Phd Student Linux Technology Center
University of Limerick IBM Dublin Software Lab