Re: [PATCH 17/23] mm: count writeback pages per BDI

Peter Zijlstra
2007-08-09T19:24:54Z

On Thu, 2007-08-09 at 12:15 -0700, Christoph Lameter wrote:
> On Fri, 3 Aug 2007, Peter Zijlstra wrote:
>
> > page_index(page),
> > PAGECACHE_TAG_WRITEBACK);
> > + if (bdi_cap_writeback_dirty(bdi))
> > + __dec_bdi_stat(bdi, BDI_WRITEBACK);
>
> Why are these not incremented and decremented in the exact location of
> NR_WRITEBACK?

int test_clear_page_writeback(struct page *page)
{
struct address_space *mapping = page_mapping(page);
int ret;

if (mapping) {
struct backing_dev_info *bdi = mapping->backing_dev_info;
unsigned long flags;

write_lock_irqsave(&mapping->tree_lock, flags);
ret = TestClearPageWriteback(page);
if (ret) {
radix_tree_tag_clear(&mapping->page_tree,
page_index(page),
PAGECACHE_TAG_WRITEBACK);
if (bdi_cap_writeback_dirty(bdi)) {
__dec_bdi_stat(bdi, BDI_WRITEBACK);
__bdi_writeout_inc(bdi);
}
}
write_unlock_irqrestore(&mapping->tree_lock, flags);
} else {
ret = TestClearPageWriteback(page);
}
if (ret)
dec_zone_page_state(page, NR_WRITEBACK);
return ret;
}

Less conditionals. We already have a branch for mapping, why create
another?