]>
Commit | Line | Data |
---|---|---|
5a7ad156 FG |
1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 |
2 | From: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> | |
3 | Date: Thu, 15 Mar 2018 18:07:47 +0300 | |
4 | Subject: [PATCH] mm/thp: Do not wait for lock_page() in deferred_split_scan() | |
5 | MIME-Version: 1.0 | |
6 | Content-Type: text/plain; charset=UTF-8 | |
7 | Content-Transfer-Encoding: 8bit | |
8 | ||
9 | deferred_split_scan() gets called from reclaim path. Waiting for page | |
10 | lock may lead to deadlock there. | |
11 | ||
12 | Replace lock_page() with trylock_page() and skip the page if we failed | |
13 | to lock it. We will get to the page on the next scan. | |
14 | ||
15 | Fixes: 9a982250f773 ("thp: introduce deferred_split_huge_page()") | |
16 | ||
17 | Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> | |
18 | Acked-by: Michal Hocko <mhocko@suse.com> | |
19 | (cherry-picked from https://patchwork.kernel.org/patch/10284703/) | |
20 | Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com> | |
21 | --- | |
22 | mm/huge_memory.c | 4 +++- | |
23 | 1 file changed, 3 insertions(+), 1 deletion(-) | |
24 | ||
25 | diff --git a/mm/huge_memory.c b/mm/huge_memory.c | |
26 | index 8b887db33383..5c4093e0be8d 100644 | |
27 | --- a/mm/huge_memory.c | |
28 | +++ b/mm/huge_memory.c | |
29 | @@ -2621,11 +2621,13 @@ static unsigned long deferred_split_scan(struct shrinker *shrink, | |
30 | ||
31 | list_for_each_safe(pos, next, &list) { | |
32 | page = list_entry((void *)pos, struct page, mapping); | |
33 | - lock_page(page); | |
34 | + if (!trylock_page(page)) | |
35 | + goto next; | |
36 | /* split_huge_page() removes page from list on success */ | |
37 | if (!split_huge_page(page)) | |
38 | split++; | |
39 | unlock_page(page); | |
40 | +next: | |
41 | put_page(page); | |
42 | } | |
43 | ||
44 | -- | |
45 | 2.14.2 | |
46 |