The patch titled Subject: mm/workingset.c: avoid unnecessary max_nodes estimation in count_shadow_nodes() has been added to the -mm tree. Its filename is mm-workingsetc-avoid-unnecessary-max_nodes-estimation-in-count_shadow_nodes.patch This patch should soon appear at https://ozlabs.org/~akpm/mmots/broken-out/mm-workingsetc-avoid-unnecessary-max_nodes-estimation-in-count_shadow_nodes.patch and later at https://ozlabs.org/~akpm/mmotm/broken-out/mm-workingsetc-avoid-unnecessary-max_nodes-estimation-in-count_shadow_nodes.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/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Miaohe Lin <linmiaohe@xxxxxxxxxx> Subject: mm/workingset.c: avoid unnecessary max_nodes estimation in count_shadow_nodes() If list_lru_shrink_count is 0, we always return SHRINK_EMPTY regardless of the value of max_nodes. So we can return early if nodes == 0 to save some cpu cycles of approximating a reasonable limit for the nodes. Link: https://lkml.kernel.org/r/20210123073825.46709-1-linmiaohe@xxxxxxxxxx Signed-off-by: Miaohe Lin <linmiaohe@xxxxxxxxxx> Reviewed-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> Cc: Johannes Weiner <hannes@xxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/workingset.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) --- a/mm/workingset.c~mm-workingsetc-avoid-unnecessary-max_nodes-estimation-in-count_shadow_nodes +++ a/mm/workingset.c @@ -461,6 +461,8 @@ static unsigned long count_shadow_nodes( unsigned long pages; nodes = list_lru_shrink_count(&shadow_nodes, sc); + if (!nodes) + return SHRINK_EMPTY; /* * Approximate a reasonable limit for the nodes @@ -503,9 +505,6 @@ static unsigned long count_shadow_nodes( max_nodes = pages >> (XA_CHUNK_SHIFT - 3); - if (!nodes) - return SHRINK_EMPTY; - if (nodes <= max_nodes) return 0; return nodes - max_nodes; _ Patches currently in -mm which might be from linmiaohe@xxxxxxxxxx are mm-hugetlb-fix-potential-double-free-in-hugetlb_register_node-error-path.patch mm-hugetlb-avoid-unnecessary-hugetlb_acct_memory-call.patch mm-hugetlb-use-helper-huge_page_order-and-pages_per_huge_page.patch mm-workingsetc-avoid-unnecessary-max_nodes-estimation-in-count_shadow_nodes.patch z3fold-remove-unused-attribute-for-release_z3fold_page.patch z3fold-simplify-the-zhdr-initialization-code-in-init_z3fold_page.patch mm-compaction-remove-duplicated-vm_bug_on_page-pagelocked.patch hugetlbfs-remove-useless-bug_oninode-in-hugetlbfs_setattr.patch hugetlbfs-use-helper-macro-default_hstate-in-init_hugetlbfs_fs.patch hugetlbfs-correct-obsolete-function-name-in-hugetlbfs_read_iter.patch hugetlbfs-remove-meaningless-variable-avoid_reserve.patch mm-zsmallocc-convert-to-use-kmem_cache_zalloc-in-cache_alloc_zspage.patch