Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp3204064imm; Fri, 24 Aug 2018 12:28:07 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZxIr8gSbJSuqFfunw2lYbinFaLbBZ33mZUuSzUDRYhrrCeqpnCV4RATGqpEZLyMEO1ofv5 X-Received: by 2002:a63:f309:: with SMTP id l9-v6mr2802718pgh.369.1535138887528; Fri, 24 Aug 2018 12:28:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535138887; cv=none; d=google.com; s=arc-20160816; b=jl08meWAzImD2f4id7VRG2hH6H3zM22TO9EfzYLAU+EartnaLjnlRqM/nOoDLWV1MX OkY5ZS/OlKBfERDUUgyO9MLfEEHR1ajBe6l/qi5Iz38oRXD+KzdFgiHrAY8xoKoOy9Tp ZMuaKQ8zSE/8+ToWLAqsg0AIjaCVyATzuHj82u3a84HFlsh9JuUP2SV2IAGvBtgfLenC 1BQNhkwd4ROUh03/fFgK1tycTSsPlbpwpPdVex2bFhNT8GSeaTCfiN+xr/8qZO9J9qSn ABr4WtJvyVgL5/N/QXMUB9+7s03mTUyVb/3zW6SB51rb/Hz9iunSa89Mf4WNWxG0okT1 zlpg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=vYaPmqhvzmuzdaIlTeNPHIcGuU+/Iamv9k0Tm9yI7k0=; b=rCYfJAHwtGzr+fnzvmgLyYlAj7CASmQTFX7TlWY2l8xFf0TvPxvLxWIf3meZKrzhAV 0QgMkYTN1Puj468QFuVBcpv82SrRpR9EKScD/NYUOeawpmrSodPwOKSGpXtFwvGQ6RMP 1TJ7TQZZsY95dNrxHcy8a0BrgkHU9Thpgt9YjEvkeeoBHb8d9vlklEUyUuxnvmY99NDs j+y6xc319b9un1kpsbjFDqHUcYb0nqQPxEd2iu7+yuzEb8LFNEjzjHus+3t7Euca6nRp PIztj943ONkxN2iHvtcxieowBE6k3BkA/EvudNIk1UZtgK3DmJ9fHsN+7gzXmn6xcNGF VcCQ== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w13-v6si6982503pll.449.2018.08.24.12.27.52; Fri, 24 Aug 2018 12:28:07 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727305AbeHXXBv (ORCPT + 99 others); Fri, 24 Aug 2018 19:01:51 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:59912 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726645AbeHXXBu (ORCPT ); Fri, 24 Aug 2018 19:01:50 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 62F80402332F; Fri, 24 Aug 2018 19:25:53 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-122-125.rdu2.redhat.com [10.10.122.125]) by smtp.corp.redhat.com (Postfix) with ESMTP id AC1AE2026D6D; Fri, 24 Aug 2018 19:25:52 +0000 (UTC) From: jglisse@redhat.com To: linux-mm@kvack.org Cc: Andrew Morton , linux-kernel@vger.kernel.org, Ralph Campbell , =?UTF-8?q?J=C3=A9r=C3=B4me=20Glisse?= , "Kirill A . Shutemov" , stable@vger.kernel.org Subject: [PATCH 2/7] mm/rmap: map_pte() was not handling private ZONE_DEVICE page properly Date: Fri, 24 Aug 2018 15:25:44 -0400 Message-Id: <20180824192549.30844-3-jglisse@redhat.com> In-Reply-To: <20180824192549.30844-1-jglisse@redhat.com> References: <20180824192549.30844-1-jglisse@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Fri, 24 Aug 2018 19:25:53 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Fri, 24 Aug 2018 19:25:53 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jglisse@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ralph Campbell Private ZONE_DEVICE pages use a special pte entry and thus are not present. Properly handle this case in map_pte(), it is already handled in check_pte(), the map_pte() part was lost in some rebase most probably. Without this patch the slow migration path can not migrate back private ZONE_DEVICE memory to regular memory. This was found after stress testing migration back to system memory. This ultimatly can lead the CPU to an infinite page fault loop on the special swap entry. Signed-off-by: Ralph Campbell Signed-off-by: Jérôme Glisse Cc: Andrew Morton Cc: Kirill A. Shutemov Cc: stable@vger.kernel.org --- mm/page_vma_mapped.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/mm/page_vma_mapped.c b/mm/page_vma_mapped.c index ae3c2a35d61b..1cf5b9bfb559 100644 --- a/mm/page_vma_mapped.c +++ b/mm/page_vma_mapped.c @@ -21,6 +21,15 @@ static bool map_pte(struct page_vma_mapped_walk *pvmw) if (!is_swap_pte(*pvmw->pte)) return false; } else { + if (is_swap_pte(*pvmw->pte)) { + swp_entry_t entry; + + /* Handle un-addressable ZONE_DEVICE memory */ + entry = pte_to_swp_entry(*pvmw->pte); + if (is_device_private_entry(entry)) + return true; + } + if (!pte_present(*pvmw->pte)) return false; } -- 2.17.1