]> git.baikalelectronics.ru Git - kernel.git/commit
mm/workingset.c: avoid unnecessary max_nodes estimation in count_shadow_nodes()
authorMiaohe Lin <linmiaohe@huawei.com>
Wed, 24 Feb 2021 20:08:06 +0000 (12:08 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 24 Feb 2021 21:38:33 +0000 (13:38 -0800)
commit70273d6c17fc1b533b5658b05f6b96bf5f85c1b2
tree4bfc4b746af2ca638b7af166705d77e87a897389
parentff341ad845a35680ba13eb37d95bea21a704fb90
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@huawei.com
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/workingset.c