Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp3004803ybi; Mon, 17 Jun 2019 14:30:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqxjsbC+w/Fvo5Qeg+s1EKRxIF6KWuD1yQSM+dZbsrRCM95T//0wBmAzN6Mu7Gopcifbt7JV X-Received: by 2002:a17:902:b94a:: with SMTP id h10mr110330745pls.265.1560807002585; Mon, 17 Jun 2019 14:30:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560807002; cv=none; d=google.com; s=arc-20160816; b=dVND66VSD1didhBLaRolNv+iOntD915QQ6jN3lfMBIOxSFNDYDBVOozd259ARNtnpU +D6MtsKbrsMFSp/OuoyCJ/gWSI0gCSz7YdIBfY+RgeinI3mM6K2L6EeZSU35Pq8IrYZb rhRoWeP6omF7y3ckulL3S8ZvqCv9ce4YkfJ+Qr/UdhaudE62BrPeSMMkDDDA3Jgucqpq dxFgk359pO9mXIJtsSVGg7Vl02zDBDdLm7TnEtZHnYj+NkX0gGuQdiCj20kKH8WvkoVr sSci9R1lIeyMGc/448f1KElDorLRn9c5lpGWjnfkvVVI6gjR/vZp5ahIJaPjPzN6WqRy 2T5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=4f+iJqVD+G2FYrdvxbrYHhTgP+wsDutPu6oQ+0EOx5I=; b=I9o/jlZrvcRT7lgTvnQ6VfZvWcA+1USUGpOJGfOxp+WcKUozMl0PwMScT0mqcz8LAi GXaSJklAvGe/8/0SnQqxk4rGbNRDZRitHPsOHMB4m5gjMnLMX38m6gbHhRLaZnqsVrHe K5x9KHo1JPcJiGuF8NXvnJqNCgCKKGK9wX7k83DgNqMbB3emCtmE6t2wXzAg0o3rNUWd Z+aS1LvlNcfS+Ik4wq9Noo578+dGtJqMHZDp4haN4XlBnSThQjqP9FlWuwt/rKMQreWh 8esZ/aDcBxGp+9lekjxLSBEgnwJXrX1kAjbk+UqZbbl0MQ9s8GcuE3O6p1dw2loNpwUF lIyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Ohjm5hFc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j14si11260225pfi.276.2019.06.17.14.29.47; Mon, 17 Jun 2019 14:30:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Ohjm5hFc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730461AbfFQV14 (ORCPT + 99 others); Mon, 17 Jun 2019 17:27:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:54916 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730453AbfFQV1v (ORCPT ); Mon, 17 Jun 2019 17:27:51 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4A19821670; Mon, 17 Jun 2019 21:27:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1560806870; bh=tWefMRkelchA+e4UgU8lEUCGjI9nt4Jk4KLvr521j5k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ohjm5hFcN0bdj5UgnTGZaB3mspU2Ad8ocRzewInXWP1m6Zj4hGXmRAmljkJNGcadG lqWjNsZ+7859YTf/f8zhJvW+2cUOzm32lTKSXye6kRCIPgckbUH6UnYETzGxpNNeEW 7NFvRqg0UabMntXQG1NBYwEx5lLDc9nfBRoVkKD0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Minchan Kim , Wu Fangsuo , Andrew Morton , Michal Hocko , Pankaj Suryawanshi , Linus Torvalds Subject: [PATCH 4.14 11/53] mm/vmscan.c: fix trying to reclaim unevictable LRU page Date: Mon, 17 Jun 2019 23:09:54 +0200 Message-Id: <20190617210747.339699837@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190617210745.104187490@linuxfoundation.org> References: <20190617210745.104187490@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Minchan Kim commit a58f2cef26e1ca44182c8b22f4f4395e702a5795 upstream. There was the below bug report from Wu Fangsuo. On the CMA allocation path, isolate_migratepages_range() could isolate unevictable LRU pages and reclaim_clean_page_from_list() can try to reclaim them if they are clean file-backed pages. page:ffffffbf02f33b40 count:86 mapcount:84 mapping:ffffffc08fa7a810 index:0x24 flags: 0x19040c(referenced|uptodate|arch_1|mappedtodisk|unevictable|mlocked) raw: 000000000019040c ffffffc08fa7a810 0000000000000024 0000005600000053 raw: ffffffc009b05b20 ffffffc009b05b20 0000000000000000 ffffffc09bf3ee80 page dumped because: VM_BUG_ON_PAGE(PageLRU(page) || PageUnevictable(page)) page->mem_cgroup:ffffffc09bf3ee80 ------------[ cut here ]------------ kernel BUG at /home/build/farmland/adroid9.0/kernel/linux/mm/vmscan.c:1350! Internal error: Oops - BUG: 0 [#1] PREEMPT SMP Modules linked in: CPU: 0 PID: 7125 Comm: syz-executor Tainted: G S 4.14.81 #3 Hardware name: ASR AQUILAC EVB (DT) task: ffffffc00a54cd00 task.stack: ffffffc009b00000 PC is at shrink_page_list+0x1998/0x3240 LR is at shrink_page_list+0x1998/0x3240 pc : [] lr : [] pstate: 60400045 sp : ffffffc009b05940 .. shrink_page_list+0x1998/0x3240 reclaim_clean_pages_from_list+0x3c0/0x4f0 alloc_contig_range+0x3bc/0x650 cma_alloc+0x214/0x668 ion_cma_allocate+0x98/0x1d8 ion_alloc+0x200/0x7e0 ion_ioctl+0x18c/0x378 do_vfs_ioctl+0x17c/0x1780 SyS_ioctl+0xac/0xc0 Wu found it's due to commit ad6b67041a45 ("mm: remove SWAP_MLOCK in ttu"). Before that, unevictable pages go to cull_mlocked so that we can't reach the VM_BUG_ON_PAGE line. To fix the issue, this patch filters out unevictable LRU pages from the reclaim_clean_pages_from_list in CMA. Link: http://lkml.kernel.org/r/20190524071114.74202-1-minchan@kernel.org Fixes: ad6b67041a45 ("mm: remove SWAP_MLOCK in ttu") Signed-off-by: Minchan Kim Reported-by: Wu Fangsuo Debugged-by: Wu Fangsuo Tested-by: Wu Fangsuo Reviewed-by: Andrew Morton Acked-by: Michal Hocko Cc: Pankaj Suryawanshi Cc: [4.12+] Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- mm/vmscan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -1393,7 +1393,7 @@ unsigned long reclaim_clean_pages_from_l list_for_each_entry_safe(page, next, page_list, lru) { if (page_is_file_cache(page) && !PageDirty(page) && - !__PageMovable(page)) { + !__PageMovable(page) && !PageUnevictable(page)) { ClearPageActive(page); list_move(&page->lru, &clean_pages); }