From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 05C5EC433E0 for ; Thu, 14 Jan 2021 18:02:53 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BEC7423B54 for ; Thu, 14 Jan 2021 18:02:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BEC7423B54 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=wtn5InYiApnLoZmctyAW82bk3hF097YVA3LIyE8dIyI=; b=WTWzIUdXdJeHeiVNIiIji2DIF vTWTO/yBmImXeAqK+o7i3UvownGm6fJwaqK2qNt05bChzgBgCEl9nqtOnvkyhE+PWbaOrScTtKbxQ vLzoARxthSPfT+/BFXylkljMvbWNdD3eOja5ANm+lP2vqju92yigelTjtvETYLix01PdtRc4a2bCv iY/uxuTVqrZh8WbqpEelLhXVx6NlKdlLrtHM5WD1gdT+dsQvOGrFV/lfs5bfBFu4YguAArVbn1jNI znjPRoq2lYCqkBoiK8AVTwarj3DP9XbWx3tdfaRhi38JyH5e2ovvWUlvoP7wvzk5lDXG/rbme7Os6 AhOIC+l6g==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l06vt-00077A-Ar; Thu, 14 Jan 2021 18:01:18 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l06vU-0006xG-5e for linux-arm-kernel@lists.infradead.org; Thu, 14 Jan 2021 18:00:56 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 637B923B6E; Thu, 14 Jan 2021 18:00:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1610647251; bh=5GZtx5inBi7paTjDAzc0sxuRXktlFwJSoTEoY/D7ZmE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cp9U1V8a4Q+VXkL5G4urrW8p7IY8F8ZhInSzyrprCD0gC8nSDKLyiNUCcnw6uL0rb YrBJf9gM887K+4e6re7rxuFuwdhz0GThnrFBYoU+Kz+Ya/IG7myNvRFK7ydrKzGO/C i+BAm6JQmDHYYza3SfGr5xJDf3JVURu1a7Sh6L9qPASX5r7na+kXc9HZtBAX/Eb9SX JfTDctDb1BwaHVrwoXbSInPEeuaGUUGf0tApmQCc1kM6EWDNEjOgQvX/wA8fWTqUIg wsnTmx0ywx6M0vyxCgGFIUWKinJXc4Tr9kjmRvUBNSb9ucDZcXfzBf9WEZkyTe1FNg Lv85wTU1RWTsg== From: Will Deacon To: linux-kernel@vger.kernel.org Subject: [PATCH v3 3/8] arm64: mm: Implement arch_wants_old_prefaulted_pte() Date: Thu, 14 Jan 2021 17:59:29 +0000 Message-Id: <20210114175934.13070-4-will@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210114175934.13070-1-will@kernel.org> References: <20210114175934.13070-1-will@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210114_130052_455504_F56B5711 X-CRM114-Status: GOOD ( 11.01 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kernel-team@android.com, Jan Kara , Minchan Kim , Catalin Marinas , Linus Torvalds , Hugh Dickins , linux-mm@kvack.org, Vinayak Menon , "Kirill A . Shutemov" , Andrew Morton , Will Deacon , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On CPUs with hardware AF/DBM, initialising prefaulted PTEs as 'old' improves vmscan behaviour and does not appear to introduce any overhead elsewhere. Implement arch_wants_old_prefaulted_pte() to return 'true' if we detect hardware access flag support at runtime. This can be extended in future based on MIDR matching if necessary. Cc: Catalin Marinas Signed-off-by: Will Deacon --- arch/arm64/include/asm/pgtable.h | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h index 501562793ce2..e17b96d0e4b5 100644 --- a/arch/arm64/include/asm/pgtable.h +++ b/arch/arm64/include/asm/pgtable.h @@ -980,7 +980,17 @@ static inline bool arch_faults_on_old_pte(void) return !cpu_has_hw_af(); } -#define arch_faults_on_old_pte arch_faults_on_old_pte +#define arch_faults_on_old_pte arch_faults_on_old_pte + +/* + * Experimentally, it's cheap to set the access flag in hardware and we + * benefit from prefaulting mappings as 'old' to start with. + */ +static inline bool arch_wants_old_prefaulted_pte(void) +{ + return !arch_faults_on_old_pte(); +} +#define arch_wants_old_prefaulted_pte arch_wants_old_prefaulted_pte #endif /* !__ASSEMBLY__ */ -- 2.30.0.284.gd98b1dd5eaa7-goog _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel