Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp311581ybv; Wed, 19 Feb 2020 22:11:15 -0800 (PST) X-Google-Smtp-Source: APXvYqybLekfKdjFYs12uaR+gj7Hoe8qmybT+2zQk/G/TnHLuPVgWt6FYhKX0qOqBIV0T/uLeXuN X-Received: by 2002:aca:484a:: with SMTP id v71mr432506oia.39.1582179075497; Wed, 19 Feb 2020 22:11:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582179075; cv=none; d=google.com; s=arc-20160816; b=qz5hE4NBTGDfNEZb5l7Ota9t5X44NbolqjnMinsvGmweYgvuxb2dBR3bcGjIE1QfIK T4EICP/gXhTd79LPjwLH2PIhRYa/md/tkJzJBgiHVoIucNNV8D98q7T6u/H81nZKj2J4 RYc8v/I8B1P+7NMskFP8+f13lNVGR27IwM23Bgaxqd23LZKnNdXM4Fon9UWq5Z8icv5b vEdVpKjr3Vc4CCF2VDFWtXVN1gYq2FTCL5uwJdPNErpJAUpPlQOiQabQ08oGDLNsGXN/ Nn9tornWVB+sp/0MSodJCzi1/z3GHHj+oybBfzC5kx61W+Maf+WABAEyJFeO15mRNrh0 GT1g== 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 :message-id:date:subject:cc:to:from; bh=q0gtO4xOKrINlGwJFaqSYGlJzjKciaJz3M5LU4iAHBA=; b=S769WjkngeiC/anVGzt/1BBzQ/aR3qaocph8ScGhiS/1oclMgwu6y+/cvulEe0o0Lk n2EknbFBtVkJDgjHQLlorX8lCaC4kWwfIEvIq9Gu8CeVV5AfQXk4vTUAmZiNnZKcpRbO oxL8PlFHP5SoVW385yY00bnd463J8OLo3rCU1p3ZcrUHKkAXusRf6BjK31qMwjErcWXg l+vqo5ZCrIM1Ly5zH8UCJmGdxT2Idv7C1CW5F4RV7JpEX/XI0jOXx9/o2Xko7eXMgvm1 KUPHEEJaCf896ZzZNKzfiduda7LqFVp5fE8S8CjiAU49g3ggjX94Do+XL/mmQbKWn++4 62+g== 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 l17si1194771otq.59.2020.02.19.22.11.02; Wed, 19 Feb 2020 22:11:15 -0800 (PST) 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 S1726165AbgBTGKx (ORCPT + 99 others); Thu, 20 Feb 2020 01:10:53 -0500 Received: from relay10.mail.gandi.net ([217.70.178.230]:38347 "EHLO relay10.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725942AbgBTGKx (ORCPT ); Thu, 20 Feb 2020 01:10:53 -0500 Received: from debian.numericable.fr (127.19.86.79.rev.sfr.net [79.86.19.127]) (Authenticated sender: alex@ghiti.fr) by relay10.mail.gandi.net (Postfix) with ESMTPSA id 6C72B240005; Thu, 20 Feb 2020 06:10:50 +0000 (UTC) From: Alexandre Ghiti To: Paul Walmsley , Palmer Dabbelt , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Alexandre Ghiti Subject: [PATCH] riscv: Use p*d_leaf macros to define p*d_huge Date: Thu, 20 Feb 2020 01:10:23 -0500 Message-Id: <20200220061023.958-1-alex@ghiti.fr> X-Mailer: git-send-email 2.20.1 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 The newly introduced p*d_leaf macros allow to check if an entry of the page table map to a physical page instead of the next level. To avoid duplication of code, use those macros to determine if a page table entry points to a hugepage. Suggested-by: Paul Walmsley Signed-off-by: Alexandre Ghiti --- arch/riscv/mm/hugetlbpage.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/arch/riscv/mm/hugetlbpage.c b/arch/riscv/mm/hugetlbpage.c index 0d4747e9d5b5..a6189ed36c5f 100644 --- a/arch/riscv/mm/hugetlbpage.c +++ b/arch/riscv/mm/hugetlbpage.c @@ -4,14 +4,12 @@ int pud_huge(pud_t pud) { - return pud_present(pud) && - (pud_val(pud) & (_PAGE_READ | _PAGE_WRITE | _PAGE_EXEC)); + return pud_leaf(pud); } int pmd_huge(pmd_t pmd) { - return pmd_present(pmd) && - (pmd_val(pmd) & (_PAGE_READ | _PAGE_WRITE | _PAGE_EXEC)); + return pmd_leaf(pmd); } static __init int setup_hugepagesz(char *opt) -- 2.20.1