The patch titled writeback: avoid unnecessary determine_dirtyable_memory call has been added to the -mm tree. Its filename is writeback-avoid-unnecessary-determine_dirtyable_memory-call.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** See http://userweb.kernel.org/~akpm/stuff/added-to-mm.txt to find out what to do about this The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/ ------------------------------------------------------ Subject: writeback: avoid unnecessary determine_dirtyable_memory call From: Minchan Kim <minchan.kim@xxxxxxxxx> I think determine_dirtyable_memory() is a rather costly function since it need many atomic reads for gathering zone/global page state. But when we use vm_dirty_bytes && dirty_background_bytes, we don't need that costly calculation. This patch eliminates such unnecessary overhead. NOTE : newly added if condition might add overhead in normal path. But it should be _really_ small because anyway we need the access both vm_dirty_bytes and dirty_background_bytes so it is likely to hit the cache. Signed-off-by: Minchan Kim <minchan.kim@xxxxxxxxx> Cc: Wu Fengguang <fengguang.wu@xxxxxxxxx> Cc: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/page-writeback.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff -puN mm/page-writeback.c~writeback-avoid-unnecessary-determine_dirtyable_memory-call mm/page-writeback.c --- a/mm/page-writeback.c~writeback-avoid-unnecessary-determine_dirtyable_memory-call +++ a/mm/page-writeback.c @@ -390,9 +390,12 @@ void global_dirty_limits(unsigned long * { unsigned long background; unsigned long dirty; - unsigned long available_memory = determine_dirtyable_memory(); + unsigned long available_memory; struct task_struct *tsk; + if (!vm_dirty_bytes || !dirty_background_bytes) + available_memory = determine_dirtyable_memory(); + if (vm_dirty_bytes) dirty = DIV_ROUND_UP(vm_dirty_bytes, PAGE_SIZE); else _ Patches currently in -mm which might be from minchan.kim@xxxxxxxxx are linux-next.patch mm-vmap-area-cache.patch mm-find_get_pages_contig-fixlet.patch mm-deactivate-invalidated-pages.patch mm-deactivate-invalidated-pages-fix.patch vmalloc-remove-redundant-unlikely.patch mm-kswapd-stop-high-order-balancing-when-any-suitable-zone-is-balanced.patch mm-kswapd-keep-kswapd-awake-for-high-order-allocations-until-a-percentage-of-the-node-is-balanced.patch mm-kswapd-use-the-order-that-kswapd-was-reclaiming-at-for-sleeping_prematurely.patch mm-kswapd-reset-kswapd_max_order-and-classzone_idx-after-reading.patch mm-kswapd-treat-zone-all_unreclaimable-in-sleeping_prematurely-similar-to-balance_pgdat.patch mm-kswapd-use-the-classzone-idx-that-kswapd-was-using-for-sleeping_prematurely.patch writeback-avoid-unnecessary-determine_dirtyable_memory-call.patch writeback-avoid-unnecessary-determine_dirtyable_memory-call-fix.patch mm-migration-use-rcu_dereference_protected-when-dereferencing-the-radix-tree-slot-during-file-page-migration.patch mm-hugetlbc-fix-error-path-memory-leak-in-nr_hugepages_store_common.patch mm-hugetlbc-fix-error-path-memory-leak-in-nr_hugepages_store_common-fix.patch memcg-add-page_cgroup-flags-for-dirty-page-tracking.patch memcg-document-cgroup-dirty-memory-interfaces.patch memcg-document-cgroup-dirty-memory-interfaces-fix.patch memcg-create-extensible-page-stat-update-routines.patch memcg-add-lock-to-synchronize-page-accounting-and-migration.patch memcg-remove-unnecessary-return-from-void-returning-mem_cgroup_del_lru_list.patch memcg-use-zalloc-rather-than-mallocmemset.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html