]>
Commit | Line | Data |
---|---|---|
80ae7e1e GKH |
1 | From a58f2cef26e1ca44182c8b22f4f4395e702a5795 Mon Sep 17 00:00:00 2001 |
2 | From: Minchan Kim <minchan@kernel.org> | |
3 | Date: Thu, 13 Jun 2019 15:56:15 -0700 | |
4 | Subject: mm/vmscan.c: fix trying to reclaim unevictable LRU page | |
5 | ||
6 | From: Minchan Kim <minchan@kernel.org> | |
7 | ||
8 | commit a58f2cef26e1ca44182c8b22f4f4395e702a5795 upstream. | |
9 | ||
10 | There was the below bug report from Wu Fangsuo. | |
11 | ||
12 | On the CMA allocation path, isolate_migratepages_range() could isolate | |
13 | unevictable LRU pages and reclaim_clean_page_from_list() can try to | |
14 | reclaim them if they are clean file-backed pages. | |
15 | ||
16 | page:ffffffbf02f33b40 count:86 mapcount:84 mapping:ffffffc08fa7a810 index:0x24 | |
17 | flags: 0x19040c(referenced|uptodate|arch_1|mappedtodisk|unevictable|mlocked) | |
18 | raw: 000000000019040c ffffffc08fa7a810 0000000000000024 0000005600000053 | |
19 | raw: ffffffc009b05b20 ffffffc009b05b20 0000000000000000 ffffffc09bf3ee80 | |
20 | page dumped because: VM_BUG_ON_PAGE(PageLRU(page) || PageUnevictable(page)) | |
21 | page->mem_cgroup:ffffffc09bf3ee80 | |
22 | ------------[ cut here ]------------ | |
23 | kernel BUG at /home/build/farmland/adroid9.0/kernel/linux/mm/vmscan.c:1350! | |
24 | Internal error: Oops - BUG: 0 [#1] PREEMPT SMP | |
25 | Modules linked in: | |
26 | CPU: 0 PID: 7125 Comm: syz-executor Tainted: G S 4.14.81 #3 | |
27 | Hardware name: ASR AQUILAC EVB (DT) | |
28 | task: ffffffc00a54cd00 task.stack: ffffffc009b00000 | |
29 | PC is at shrink_page_list+0x1998/0x3240 | |
30 | LR is at shrink_page_list+0x1998/0x3240 | |
31 | pc : [<ffffff90083a2158>] lr : [<ffffff90083a2158>] pstate: 60400045 | |
32 | sp : ffffffc009b05940 | |
33 | .. | |
34 | shrink_page_list+0x1998/0x3240 | |
35 | reclaim_clean_pages_from_list+0x3c0/0x4f0 | |
36 | alloc_contig_range+0x3bc/0x650 | |
37 | cma_alloc+0x214/0x668 | |
38 | ion_cma_allocate+0x98/0x1d8 | |
39 | ion_alloc+0x200/0x7e0 | |
40 | ion_ioctl+0x18c/0x378 | |
41 | do_vfs_ioctl+0x17c/0x1780 | |
42 | SyS_ioctl+0xac/0xc0 | |
43 | ||
44 | Wu found it's due to commit ad6b67041a45 ("mm: remove SWAP_MLOCK in | |
45 | ttu"). Before that, unevictable pages go to cull_mlocked so that we | |
46 | can't reach the VM_BUG_ON_PAGE line. | |
47 | ||
48 | To fix the issue, this patch filters out unevictable LRU pages from the | |
49 | reclaim_clean_pages_from_list in CMA. | |
50 | ||
51 | Link: http://lkml.kernel.org/r/20190524071114.74202-1-minchan@kernel.org | |
52 | Fixes: ad6b67041a45 ("mm: remove SWAP_MLOCK in ttu") | |
53 | Signed-off-by: Minchan Kim <minchan@kernel.org> | |
54 | Reported-by: Wu Fangsuo <fangsuowu@asrmicro.com> | |
55 | Debugged-by: Wu Fangsuo <fangsuowu@asrmicro.com> | |
56 | Tested-by: Wu Fangsuo <fangsuowu@asrmicro.com> | |
57 | Reviewed-by: Andrew Morton <akpm@linux-foundation.org> | |
58 | Acked-by: Michal Hocko <mhocko@suse.com> | |
59 | Cc: Pankaj Suryawanshi <pankaj.suryawanshi@einfochips.com> | |
60 | Cc: <stable@vger.kernel.org> [4.12+] | |
61 | Signed-off-by: Andrew Morton <akpm@linux-foundation.org> | |
62 | Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> | |
63 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
64 | ||
65 | --- | |
66 | mm/vmscan.c | 2 +- | |
67 | 1 file changed, 1 insertion(+), 1 deletion(-) | |
68 | ||
69 | --- a/mm/vmscan.c | |
70 | +++ b/mm/vmscan.c | |
71 | @@ -1393,7 +1393,7 @@ unsigned long reclaim_clean_pages_from_l | |
72 | ||
73 | list_for_each_entry_safe(page, next, page_list, lru) { | |
74 | if (page_is_file_cache(page) && !PageDirty(page) && | |
75 | - !__PageMovable(page)) { | |
76 | + !__PageMovable(page) && !PageUnevictable(page)) { | |
77 | ClearPageActive(page); | |
78 | list_move(&page->lru, &clean_pages); | |
79 | } |