Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp6127706ybi; Wed, 31 Jul 2019 08:48:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqzsq35yf04HgLZIaV8ZeYio7Xstk45+5MtjQY1O8dh2NWWm8eI2QFkf8zgWq5aFcMKcOg6Q X-Received: by 2002:a17:90b:f0f:: with SMTP id br15mr3656160pjb.101.1564588080573; Wed, 31 Jul 2019 08:48:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564588080; cv=none; d=google.com; s=arc-20160816; b=M2vfWKwuUVr7C6LJZBl9KJFk3dffBEd+AfTINLqo+myF9IwIgZebOPxZ1Z7Ee1vckG CBMNiZyaHzQfaOrbauqbk3xgV62WGX4zHJHtwrMYMr0aU2u+LWIuzmwQpacF11e8xPah XiuhLWhhgCzmiN8Y5+/BOMbLjN7XitI8RMWikb/LhGYiJCLO3nOEXQVLl905eEdVB0Cy xunOVHVCvEHicuGh/3hRd7AKXRbN9e2lAGt/5T0Tlb6cWsG2KZGsNcvkp191d2tT8yaS g2P9PtOusBrKjzpaK3gl/bMWiumS/iwlOftp0xAyAjANrRdBR49pJDSVHSlBs9b6CtNe B2kQ== 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; bh=x1V6OHqN3EauZVYY6EyiL7lCxOhh04YiNYXgSPv0O1I=; b=kKZsyB1pJgjnY8HtQ6axVa4HCGVqfqFdpehZqaLqEfcTwdKb4O6bCsloQugzY5/fqo qnmFkv+Ap/imLuet28+6OAxzEJDoMi2GjI4enAGY+I04Vr4ZD53w95krnDY+xze4uKHc M4Qn9VQKCEYh1YcT0zuE5BeWfGyrp5PcQijflWNxcOMJvzLsjeDMtDFSEZJMKmHPd/L5 5aGSU/tnih8M21Pqu8/TJjdq235Sx1/051+2KgJXIF3Jl1oFGSYzNp5sBDf2LIUsaa2L euTIgF6hGaxlG9NbF29DeMz5x+evKRVINVrn5nIrqkuAXQkfqQV/PmRB6YkQNhzVStmi pQTA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 78si31848223pfz.268.2019.07.31.08.47.45; Wed, 31 Jul 2019 08:48:00 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730013AbfGaPqs (ORCPT + 99 others); Wed, 31 Jul 2019 11:46:48 -0400 Received: from foss.arm.com ([217.140.110.172]:49870 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729997AbfGaPqs (ORCPT ); Wed, 31 Jul 2019 11:46:48 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 7E73F15A2; Wed, 31 Jul 2019 08:46:47 -0700 (PDT) Received: from e112269-lin.arm.com (e112269-lin.cambridge.arm.com [10.1.196.133]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E93093F694; Wed, 31 Jul 2019 08:46:44 -0700 (PDT) From: Steven Price To: linux-mm@kvack.org Cc: Steven Price , Andy Lutomirski , Ard Biesheuvel , Arnd Bergmann , Borislav Petkov , Catalin Marinas , Dave Hansen , Ingo Molnar , James Morse , =?UTF-8?q?J=C3=A9r=C3=B4me=20Glisse?= , Peter Zijlstra , Thomas Gleixner , Will Deacon , x86@kernel.org, "H. Peter Anvin" , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Mark Rutland , "Liang, Kan" , Andrew Morton Subject: [PATCH v10 12/22] mm: pagewalk: Allow walking without vma Date: Wed, 31 Jul 2019 16:45:53 +0100 Message-Id: <20190731154603.41797-13-steven.price@arm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190731154603.41797-1-steven.price@arm.com> References: <20190731154603.41797-1-steven.price@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Since 48684a65b4e3: "mm: pagewalk: fix misbehavior of walk_page_range for vma(VM_PFNMAP)", page_table_walk() will report any kernel area as a hole, because it lacks a vma. This means each arch has re-implemented page table walking when needed, for example in the per-arch ptdump walker. Remove the requirement to have a vma except when trying to split huge pages. Signed-off-by: Steven Price --- mm/pagewalk.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/mm/pagewalk.c b/mm/pagewalk.c index 98373a9f88b8..1cbef99e9258 100644 --- a/mm/pagewalk.c +++ b/mm/pagewalk.c @@ -36,7 +36,7 @@ static int walk_pmd_range(pud_t *pud, unsigned long addr, unsigned long end, do { again: next = pmd_addr_end(addr, end); - if (pmd_none(*pmd) || !walk->vma) { + if (pmd_none(*pmd)) { if (walk->pte_hole) err = walk->pte_hole(addr, next, walk); if (err) @@ -59,9 +59,14 @@ static int walk_pmd_range(pud_t *pud, unsigned long addr, unsigned long end, if (!walk->pte_entry) continue; - split_huge_pmd(walk->vma, pmd, addr); - if (pmd_trans_unstable(pmd)) - goto again; + if (walk->vma) { + split_huge_pmd(walk->vma, pmd, addr); + if (pmd_trans_unstable(pmd)) + goto again; + } else if (pmd_leaf(*pmd)) { + continue; + } + err = walk_pte_range(pmd, addr, next, walk); if (err) break; @@ -81,7 +86,7 @@ static int walk_pud_range(p4d_t *p4d, unsigned long addr, unsigned long end, do { again: next = pud_addr_end(addr, end); - if (pud_none(*pud) || !walk->vma) { + if (pud_none(*pud)) { if (walk->pte_hole) err = walk->pte_hole(addr, next, walk); if (err) @@ -95,9 +100,13 @@ static int walk_pud_range(p4d_t *p4d, unsigned long addr, unsigned long end, break; } - split_huge_pud(walk->vma, pud, addr); - if (pud_none(*pud)) - goto again; + if (walk->vma) { + split_huge_pud(walk->vma, pud, addr); + if (pud_none(*pud)) + goto again; + } else if (pud_leaf(*pud)) { + continue; + } if (walk->pmd_entry || walk->pte_entry) err = walk_pmd_range(pud, addr, next, walk); -- 2.20.1