Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp2455983imd; Fri, 2 Nov 2018 11:42:35 -0700 (PDT) X-Google-Smtp-Source: AJdET5eC6masjw3W14mec8+hxpX8zV+7pCG3dIhuqarNVmbunz8d4JvmiLJ0PQFh4OEosms7DSU6 X-Received: by 2002:a17:902:7406:: with SMTP id g6-v6mr8189427pll.335.1541184155487; Fri, 02 Nov 2018 11:42:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541184155; cv=none; d=google.com; s=arc-20160816; b=PBVp6pXMtpFjJ7oiM6eazaC/xMj9GozGah4auJeOYGPEeyNv8MtzzlIMeL37ebjIsb tZZgU+V5R8tA/ucZTJ7qLWVurEvHwJCruC0eeIZStMzPh8O03oUksYN+Fjl9/ATdKcQg UzFLrPrS556z6kfSxUSEY+6bXmqg4Vd39/oX6FaoiUlDM5D2T7oJlUWPiIJB+hC1KqyQ cHQDuT1vXTCAkpaAYsEfiTiACzm+BdX7+OSKn8PIGyWXaySDnRVMVe2rQboTsGDvY4qY xI+8FNyN9HZ3Zn0sbUddDPXqWXuTfecRzsleBvnRfopH1wiWnRCP0RQ+wxn5IWttALl/ hXGQ== 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=Uwj7BOOPeqbyoEeqPUuSUXP+oOfM0js8ftCiVuFaz1A=; b=quwF3y74wPG/lXitqxOug/PPR9ULKRYrt5ZvVwYkzBqGHnEPHNqyXCU1UbykayvBa9 0AdGGOC/R1fccMze0tvvY6DYQxxnvWBG/uxP1TXCGX6gfzKl0sAyFOFomjVEleMZgQU4 AMPdzy8fqXtI778laCHyaoGN4m8H3x5ip9EoJMa2D98CfxUVgBn6EvDsn034qlMuNynM v6D9d03U0wwHM9Gn4AUaCriAKr0AQM7mwqnuGyrYolPiS4ciMmPlTRbb3O05ZucZ8Lym PomuQ9zfyQDE9UepIBJytTx40sp7zl7V5nYsPIfCeBy43YqNAIjprgn06CznrrelOUIJ YwVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=PSd9ry1O; 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 n10-v6si34931058pgj.165.2018.11.02.11.42.21; Fri, 02 Nov 2018 11:42:35 -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=PSd9ry1O; 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 S1729549AbeKCDt2 (ORCPT + 99 others); Fri, 2 Nov 2018 23:49:28 -0400 Received: from mail.kernel.org ([198.145.29.99]:44104 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728699AbeKCDt2 (ORCPT ); Fri, 2 Nov 2018 23:49:28 -0400 Received: from localhost (5356596B.cm-6-7b.dynamic.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 80F4520848; Fri, 2 Nov 2018 18:41:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541184076; bh=00b0YqzTRz25xxlSNTeO1eXeT315IvVT4bhEetAYL2M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PSd9ry1OCvKqEHhWxvtjcUyKxqA3JwjGn0cx7Pro5zlN7ktJtm0KzJpFqgWVH7B1O WSWbprhqe+bQvpRKNFByVWU3xN+nP1cpBUzRgx3J9DOhA9Tc4GbV5ze/mG2mnHBaSY mbrZ2tELTCb+eyNbuIZ+NK70jLHaKoGb74grgd8w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Anshuman Khandual , Michal Hocko , Naoya Horiguchi , "Kirill A. Shutemov" , Zi Yan , Mike Kravetz , Vlastimil Babka , Andrew Morton , Sasha Levin Subject: [PATCH 4.18 072/150] mm/migrate.c: split only transparent huge pages when allocation fails Date: Fri, 2 Nov 2018 19:33:54 +0100 Message-Id: <20181102182908.622200912@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181102182902.250560510@linuxfoundation.org> References: <20181102182902.250560510@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review 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 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit e6112fc300702f96374f34368513d57795fc6d23 ] split_huge_page_to_list() fails on HugeTLB pages. I was experimenting with moving 32MB contig HugeTLB pages on arm64 (with a debug patch applied) and hit the following stack trace when the kernel crashed. [ 3732.462797] Call trace: [ 3732.462835] split_huge_page_to_list+0x3b0/0x858 [ 3732.462913] migrate_pages+0x728/0xc20 [ 3732.462999] soft_offline_page+0x448/0x8b0 [ 3732.463097] __arm64_sys_madvise+0x724/0x850 [ 3732.463197] el0_svc_handler+0x74/0x110 [ 3732.463297] el0_svc+0x8/0xc [ 3732.463347] Code: d1000400 f90b0e60 f2fbd5a2 a94982a1 (f9000420) When unmap_and_move[_huge_page]() fails due to lack of memory, the splitting should happen only for transparent huge pages not for HugeTLB pages. PageTransHuge() returns true for both THP and HugeTLB pages. Hence the conditonal check should test PagesHuge() flag to make sure that given pages is not a HugeTLB one. Link: http://lkml.kernel.org/r/1537798495-4996-1-git-send-email-anshuman.khandual@arm.com Fixes: 94723aafb9 ("mm: unclutter THP migration") Signed-off-by: Anshuman Khandual Acked-by: Michal Hocko Acked-by: Naoya Horiguchi Cc: Kirill A. Shutemov Cc: Zi Yan Cc: Mike Kravetz Cc: Vlastimil Babka Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- mm/migrate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/migrate.c b/mm/migrate.c index 2a55289ee9f1..f49eb9589d73 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -1415,7 +1415,7 @@ retry: * we encounter them after the rest of the list * is processed. */ - if (PageTransHuge(page)) { + if (PageTransHuge(page) && !PageHuge(page)) { lock_page(page); rc = split_huge_page_to_list(page, from); unlock_page(page); -- 2.17.1