Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp4456336ybp; Mon, 7 Oct 2019 08:42:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqylQDV+hfJQOKW8Bk260JZM6cPf+m+TTktISgtdtkyeJPgg8TonCz2jxYSDYQiLeh+2LnQ4 X-Received: by 2002:a50:ab0f:: with SMTP id s15mr792011edc.119.1570462942945; Mon, 07 Oct 2019 08:42:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570462942; cv=none; d=google.com; s=arc-20160816; b=yzUiqppyMy+lET39rp2yWgzgmLxLWk9oWXdP3XD6SaxKarI7ZUrYfZ19UTcKN6xn81 bmGOL3W0qgdWjZ1krscTOUaiwVhN/rd61iM9W8J4UniY/7szSfZTw/+0nmygji0KjgTj RN1h5jy1yy06lIK86YGEH6tBgyI9WQvkfUiRib77ulJeqlm43gs2jTjEDfkO8fny3nx1 zvkeDc1yiIDw1fL2UEJ2id7RdK6gu7zW2kyE83R8xDGEA9qC5HCoOeoHFxCFPc2cvRGv 1X+hAG4rMQcOiDW5ZZKNPpOkX26mt1vBefin1XSg0aNsHZCLmN4ndnzo2nGlRT/51yd7 g8Xw== 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=1gczTWm3X21cYvXWS66LdJXoTa+ikl6Kzj7XOxs5fJg=; b=02mj3WicLdJrAf9qy3N9xYSsfB9ff/fgvimHnJhlzlu1UdrI8wwCEt+dVqAZe6sxDX sEa9PKdSH8t9JC7XuRFEmHYN42bGQ/4XyWajDcKRo3+m+kFW46ZwrJB3qMQ1IbMciuue 4EUEPg89ZSO7qn+lCuzHxGiS2bXUjl8dpsS96jEFaJZjZ51wrEFgJ+eVedbP05PAEFzV qZd/GBXxOwYLWxqSHlKm6bTThXxxXjv19PYfmAKMzaU4MYTE+0MGPRzx51M2pdIG67h7 tPpnJSMSqupqhL7W3bc3s6MUmYD8g9uOv8quEdYzW0LvrSjNmNIPI+7gw+E3BzyDzM89 mxxg== 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 u8si7362534ejt.219.2019.10.07.08.41.59; Mon, 07 Oct 2019 08:42:22 -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 S1729071AbfJGPjS (ORCPT + 99 others); Mon, 7 Oct 2019 11:39:18 -0400 Received: from foss.arm.com ([217.140.110.172]:38596 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728981AbfJGPjR (ORCPT ); Mon, 7 Oct 2019 11:39:17 -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 52FE216A3; Mon, 7 Oct 2019 08:39:17 -0700 (PDT) Received: from e112269-lin.arm.com (unknown [10.1.197.21]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id BC6A43F6C4; Mon, 7 Oct 2019 08:39:14 -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 v11 12/22] mm: pagewalk: Allow walking without vma Date: Mon, 7 Oct 2019 16:38:12 +0100 Message-Id: <20191007153822.16518-13-steven.price@arm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191007153822.16518-1-steven.price@arm.com> References: <20191007153822.16518-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 fc4d98a3a5a0..4139e9163aee 100644 --- a/mm/pagewalk.c +++ b/mm/pagewalk.c @@ -38,7 +38,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 (ops->pte_hole) err = ops->pte_hole(addr, next, walk); if (err) @@ -61,9 +61,14 @@ static int walk_pmd_range(pud_t *pud, unsigned long addr, unsigned long end, if (!ops->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; @@ -84,7 +89,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 (ops->pte_hole) err = ops->pte_hole(addr, next, walk); if (err) @@ -98,9 +103,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 (ops->pmd_entry || ops->pte_entry) err = walk_pmd_range(pud, addr, next, walk); -- 2.20.1