On Wed, Oct 07, 2009 at 06:38:37PM +0800, Nikita Danilov wrote: > Hello, > > > When pageout a dirty page, try to piggy back more consecutive dirty > > pages (up to 512KB) to improve IO efficiency. > > > > Only ext3/reiserfs which don't have its own aops->writepages are > > supported in this initial version. > > > > [...] > > > /* > > + * only write_cache_pages() supports for_reclaim for now > > + */ > > + if (!mapping->a_ops->writepages) { > > + wbc.range_start = (page->index + 1) << PAGE_CACHE_SHIFT; > > + wbc.nr_to_write = LUMPY_PAGEOUT_PAGES - 1; > > + generic_writepages(mapping, &wbc); > > + } > > This might end up calling ->writepage() on a page_mapped() page, > which used to be a problem, at least for shmem (see > BUG_ON(page_mapped(page)) in shmem_writepage()). Good catch, thanks a lot! > I tried to do a similar thing in the past, but eventually decided > do explicitly call ->writepage() in a loop from vmscan.c. This > way one can also filter out referenced and active pages. See > http://linuxhacker.ru/~nikita/patches/2.6.14-rc5/05-cluster-pageout.patch, > it also contains a comment explaining shmem problem. Glad to know about your experiences :) Interestingly I started with ->writepage() and then switch to ->writepages() because filesystems behave better with the latter (i.e. less file fragmentation). I'd like to just ignore the shmem case, by adding a bdi_cap_writeback_dirty() check. Because clustered writing to swap device may be a less gain. Page filtering should also be possible in write_cache_pages(). But what do you mean by "hard-to-fix races against inode reclamation"? Thanks, Fengguang -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html