From patchwork Wed Mar 6 15:50:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Price X-Patchwork-Id: 10841375 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 1441817E0 for ; Wed, 6 Mar 2019 15:51:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EFE032E793 for ; Wed, 6 Mar 2019 15:51:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EDBCC2E783; Wed, 6 Mar 2019 15:51:49 +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 6A8F42E789 for ; Wed, 6 Mar 2019 15:51:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B9EAB8E0013; Wed, 6 Mar 2019 10:51:30 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id B76E18E0002; Wed, 6 Mar 2019 10:51:30 -0500 (EST) 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 A156A8E0013; Wed, 6 Mar 2019 10:51:30 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by kanga.kvack.org (Postfix) with ESMTP id 485D98E0002 for ; Wed, 6 Mar 2019 10:51:30 -0500 (EST) Received: by mail-ed1-f70.google.com with SMTP id m25so6553359edd.6 for ; Wed, 06 Mar 2019 07:51:30 -0800 (PST) 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=NXbLxkVEjkUC98nDqbwMu9XwBnfr8Fy+W9xUz87hsi8=; b=RWGP8MQSkVeoeLICm8a+huNeS+QgLG9x4b8zbJ3u22Q0Od5cSZLMyNXtDmD5XJnK2K UstEu7e7ygrqx3G1qX7CWkuJu8pbhSTrx+rYlM/dfv/HsV9gsGM2ObDat5IKFkj26A/y LXH9ggj/uAY0+KGxL/1VV9sPutygGhNRnkjagec0IjPTA4w5EfIUcVl2G/1FZ+Xss4en 5BX5yGNJjn8wBd/ShH9Mjeb+CekGgmkmXZIfnIg6PCf2Ko67NTHoOoTYiFGF9u3scfOJ g7yOXjIJSVe50wlfWY9Qb/SGIYXLgccxQbccZhDh1lTFH3G37MJnsBVI2WobXI8oDCwW uElg== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com X-Gm-Message-State: APjAAAVVbyu8b8NzISMaTiwIqw8UnAbsCIgtnl8oHZMS04W9rQGhajbp 6C+sIIsHzFaqOspF04LLzs1G+3wi0/6iRzAR8r1xRg42c4ATaDDr5SambjvQKpMtkjL/I4gYvy4 R3xcDO63bwRO1l3m0rdVd4/5QAUXXsctVnoZTfnhO1zuIi3IxtOTWNK56yK2M3Ky0xw== X-Received: by 2002:a50:8eab:: with SMTP id w40mr24985888edw.172.1551887489515; Wed, 06 Mar 2019 07:51:29 -0800 (PST) X-Google-Smtp-Source: APXvYqwk9yH1bT3T7hC8Tl+StBsl9D2vekfGpdFU6gKha8/VtRTVeSftgJQJWM7hmzXmbPQAm9XC X-Received: by 2002:a50:8eab:: with SMTP id w40mr24985784edw.172.1551887487981; Wed, 06 Mar 2019 07:51:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551887487; cv=none; d=google.com; s=arc-20160816; b=JEilWf5TWxO7eo0C3g7xNWZiOdhHMfehKQoM4PGNMmOt3dSfAgK2T1Qw5CEnfCT03T tcGbt/LBl0WqZOwscduGX92OKu+d4VejNzipAjeZ/n0fPh1PMqLiyYevsgl7oQDAkUnm WKAELDkU/8pd1uyUoV/ngVNchQIcfdPKqBZkwrsbaR7tp7QA5qSmzyxIEqU8H4JH+5oN joiGm2NcI23irmpAQrGMMlj/Af0uy7h4IQakH64OO8/1rvMqq/qo2I6zjymMFZ6mrEX7 U6gZWS6zo0J/W3yUGD2RdWQKJAk6uUB7K/5l1P8LyltQPuJoOfBzL7+bZCFhsYckLjdF PJ4w== 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; bh=NXbLxkVEjkUC98nDqbwMu9XwBnfr8Fy+W9xUz87hsi8=; b=DFHihknwM89do0+VIBn+dxBxbnUsigVuyvfjYgwl6DRk/c83vUPLlnO7lNT/VG6OMY fiqh59Bfk3C/j90QJHx5p7d4QwC8161avN24X9daUNmBMR8Xg/wVsTT+EYrfHpiFUofj hPkvOGqgrJrnLnCuVgOlp8RtViAowpffML3rxIA4bvMegIDO0tKHZ8ECuR831rM8+rqm zY89B5gGCEUnITOhkl04FLP681WMUfbM11yxl7Yv5lSuY6/2miJtM87ZiQsShAqfXjn5 8a+qxJiRRR2wO+6Xf1yKSVe3lc0WOcQPmVLISXjEkGNWrfgXTwhJ99D+yn1W8xAayWwt J99w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com Received: from foss.arm.com (usa-sjc-mx-foss1.foss.arm.com. [217.140.101.70]) by mx.google.com with ESMTP id p18si725435ejz.318.2019.03.06.07.51.27 for ; Wed, 06 Mar 2019 07:51:27 -0800 (PST) Received-SPF: pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) client-ip=217.140.101.70; Authentication-Results: mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 1760F1993; Wed, 6 Mar 2019 07:51:27 -0800 (PST) Received: from e112269-lin.arm.com (e112269-lin.cambridge.arm.com [10.1.196.69]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D017A3F703; Wed, 6 Mar 2019 07:51:23 -0800 (PST) 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?b?SsOpcsO0bWUgR2xpc3Nl?= , 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" Subject: [PATCH v4 11/19] mm: pagewalk: Allow walking without vma Date: Wed, 6 Mar 2019 15:50:23 +0000 Message-Id: <20190306155031.4291-12-steven.price@arm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190306155031.4291-1-steven.price@arm.com> References: <20190306155031.4291-1-steven.price@arm.com> MIME-Version: 1.0 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 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..dac0c848b458 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_large(*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_large(*pud)) { + continue; + } if (walk->pmd_entry || walk->pte_entry) err = walk_pmd_range(pud, addr, next, walk);