From patchwork Fri Aug 24 19:25:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jerome Glisse X-Patchwork-Id: 10575701 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C7D61921 for ; Fri, 24 Aug 2018 19:26:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B7D592BA85 for ; Fri, 24 Aug 2018 19:26:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AC3C22BAE7; Fri, 24 Aug 2018 19:26:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 36FA12BA85 for ; Fri, 24 Aug 2018 19:26:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F3CE56B312D; Fri, 24 Aug 2018 15:25:54 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id E70816B312E; Fri, 24 Aug 2018 15:25:54 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D12AE6B312F; Fri, 24 Aug 2018 15:25:54 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qk0-f200.google.com (mail-qk0-f200.google.com [209.85.220.200]) by kanga.kvack.org (Postfix) with ESMTP id 9BE6D6B312D for ; Fri, 24 Aug 2018 15:25:54 -0400 (EDT) Received: by mail-qk0-f200.google.com with SMTP id u129-v6so8613359qkf.15 for ; Fri, 24 Aug 2018 12:25:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=vYaPmqhvzmuzdaIlTeNPHIcGuU+/Iamv9k0Tm9yI7k0=; b=rL2HWucrYFxLtI5TGOZEdTWjC5kqUGiZZTUIkv2udjq7RfpmItjKHH3LwRIH3k5pSG H5TIjPAk/bV2lXgQ7uQQPrwzNPm5WKGlFik9zrfQZfwLANBcLzD9nnq/gH1EhNEPZKvO nW7p9R9gbPxqco4Oho7oAG5uyAa5V/1rFq6aqcL7SUKqw+hiJDEr3DenH5EAR6MArS4E qp6Qho6GeU8b75Z+zCJYtoFuEMk27EUVvH9LmMDRlBZiNto809UJS38+k06RrDXrfhbL bnLdyq9SmgLyqR6PvtZmCGNU2NjFKvRXzJyW+E+43tW5l26q8yi/0w0ptlcVKOrk804c StUw== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of jglisse@redhat.com designates 66.187.233.73 as permitted sender) smtp.mailfrom=jglisse@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com X-Gm-Message-State: APzg51DS7PnGvEwa2TM/D+7xet7r4n4pqa7r1dH+mVmDvubcazzYbhR4 kFNffSodM+lm5TUw1B0SYmb3KJG0KiJXdtifRUcaJ9o9yrAV1Zei99siq0HCPRYCI5hdTMFu5YP yeR10aULABUil+kdm8+Qzs/mKOnbLW9qYmmEwCPs8aM1jKUc5H1AIBrRkRdwnXFBaqA== X-Received: by 2002:ac8:36fa:: with SMTP id b55-v6mr3434768qtc.49.1535138754424; Fri, 24 Aug 2018 12:25:54 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaAt8Z2crL9D0KMm7Td22a3SsCueXuLIZDIzF+fBU7jOJFvLnlk2RJs1JB9p9DbvqbgGHWY X-Received: by 2002:ac8:36fa:: with SMTP id b55-v6mr3434713qtc.49.1535138753721; Fri, 24 Aug 2018 12:25:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535138753; cv=none; d=google.com; s=arc-20160816; b=GUMWPcImb20vtDEjelMh4t7TPm7+2FpjAOHmOpyDITN3Lpdd7sZ8vEkyJf5pbpSn2l 4CNrjWSQYoQBsw144usVAofkkE0DGCXPp2g+BgBRMeZJ9qhwR+IHqW1KeAhr9GjPI57l R8wg5kH9PVTQX+REU3rKBiXKrianZ0OfJXjkyAizRU22GK4vJOw8Ugc/5QJSdvDkFmEB 6Z4d9YHis7o9rDGumBNlXoWyNV6mU3h6slJmwUe3b+JArQnIsDTMmgobFoTmqUHQ6u2P Dr0rblncsKbz3dRuudqtE7VYV7qU430fyPPX7TG7tGRDmPXFdSHmzk/7m81dGMCpDjbc LLlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=vYaPmqhvzmuzdaIlTeNPHIcGuU+/Iamv9k0Tm9yI7k0=; b=M2gYklnWuIaapA7GSYJRwQ4ctu+yN/hb5Sy8U3egtP62aHure0jW6pbgkdwkm4dNco 9A+p3Qacm1dc/qr9Q7UQIdFU8iSOu07Ook0xdSL6vKYdm3pcYtdy2vnWPPDJB06770j7 QV3kMoGMuoPU5dYNG9GcYADPGdjOA8qyIC0N9Dsfv/nIGT4GqBVxBk4bV12tq+z78MzQ cnOScQi5UWr6hhX4SDdalhuaoYPCHhXepE6nO7d4W8NHFBJA0gNxrw5alEjHSjZOqawZ Jas1L1dsKL5k2gDHCkfRnc9x00V6KJRp/O0DdA8r2Q4IciS93//OxAxQmyuSRx8dBMji P2iA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of jglisse@redhat.com designates 66.187.233.73 as permitted sender) smtp.mailfrom=jglisse@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from mx1.redhat.com (mx3-rdu2.redhat.com. [66.187.233.73]) by mx.google.com with ESMTPS id o23-v6si1162440qtp.279.2018.08.24.12.25.53 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Aug 2018 12:25:53 -0700 (PDT) Received-SPF: pass (google.com: domain of jglisse@redhat.com designates 66.187.233.73 as permitted sender) client-ip=66.187.233.73; Authentication-Results: mx.google.com; spf=pass (google.com: domain of jglisse@redhat.com designates 66.187.233.73 as permitted sender) smtp.mailfrom=jglisse@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com 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?b?SsOpcsO0bWUgR2xpc3Nl?= , "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 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:'' X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP 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; }