]> www.infradead.org Git - users/willy/linux.git/commit
mm: ksm: do not block on page lock when searching stable tree
authorYang Shi <yang.shi@linux.alibaba.com>
Wed, 5 Dec 2018 00:13:32 +0000 (11:13 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 5 Dec 2018 00:13:32 +0000 (11:13 +1100)
commitb5a464081a71e55d5e371e7e6c93a2e6b6a6ca04
treeba3898b5c179de6067431d8895e45ea508a8bc78
parent6b4dbcacd2e7546283bb6761c84af7b4594fceb7
mm: ksm: do not block on page lock when searching stable tree

ksmd needs to search the stable tree to look for a suitable KSM page, but
the KSM page might be locked for a long time due to the KSM page rmap
walk.

It is not worth waiting for the lock; the page can be skipped and we can
then try to merge it in the next scan to avoid long stalls if its content
is still intact.

Introduce an async mode to get_ksm_page() to not block on the page lock,
as try_to_merge_one_page() does.

Return -EBUSY if the trylock fails, since a NULL means failure to find a
suitable KSM page, which is a valid case.

Link: http://lkml.kernel.org/r/1541618201-120667-2-git-send-email-yang.shi@linux.alibaba.com
Signed-off-by: Yang Shi <yang.shi@linux.alibaba.com>
Reviewed-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Hugh Dickins <hughd@google.com>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
mm/ksm.c