If the current process is in a non-root memcg, thenglobal_dirty_limits() will consider the memcg dirty limit.This allows different cgroups to have distinct dirty limitswhich trigger direct and background writeback at differentlevels.

diff --git a/mm/page-writeback.c b/mm/page-writeback.cindex a0bb3e2..9b34f01 100644--- a/mm/page-writeback.c+++ b/mm/page-writeback.c@@ -180,7 +180,7 @@ static unsigned long highmem_dirtyable_memory(unsigned long total) * Returns the numebr of pages that can currently be freed and used * by the kernel for direct mappings. */-static unsigned long determine_dirtyable_memory(void)+static unsigned long global_dirtyable_memory(void) { unsigned long x;