I agree mem_cgroup_has_dirty_limit() is nicer. But we must do that underRCU, so something like:

rcu_read_lock(); if (mem_cgroup_has_dirty_limit()) mem_cgroup_get_page_stat() else global_page_state() rcu_read_unlock();That is bad when mem_cgroup_has_dirty_limit() always returns false(e.g., when memory cgroups are disabled). So I fallback to the oldinterface.

> > Which raises another question, you should probably rebase on top of> Trond's patches, which removes BDI_RECLAIMABLE, suggesting you also> loose MEMCG_NR_RECLAIM_PAGES in favour of the DIRTY+UNSTABLE split.