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 977C9C433E0 for ; Wed, 20 Jan 2021 17:39:06 +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 3FEA42070A for ; Wed, 20 Jan 2021 17:39:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3FEA42070A 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=aFDBsj5fr2JXwbp8WlgIndCYp hkMnTiHIIsOZnW5d8RGwLejJrNIOjtmhzQln5s7jtULk2XcBCgF/X4BMiY2cOYpUs6BClX9jWxzUc 5zVm0ZATZ5kZznEP6kMFxtHJlUdOx6MTwy3yRA8qVd6QqRtqNYiPHHYy4lA6Pv2oDhJUpPNpVls5c cWx3Vig7NWpvOTctBtkphmH+vYwZrb8fC7d6ri98pRSX8B5Pl5+bh93dk5NbIz6sZKM+EsUUDl0Z0 UgdsF0OzFSwSimPloHQ8S4uvoDZ3WLMldivyMDeiJwdtxSxOWSsfNuZkK0Y69S+oO0RI3Pf1ToSMj pPOxtHfbw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2HPY-0002As-EJ; Wed, 20 Jan 2021 17:36:52 +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 1l2HPD-00024N-9A for linux-arm-kernel@lists.infradead.org; Wed, 20 Jan 2021 17:36:41 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4702E207C4; Wed, 20 Jan 2021 17:36:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1611164190; bh=5GZtx5inBi7paTjDAzc0sxuRXktlFwJSoTEoY/D7ZmE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GdWQv3xvaA0v2TUZLwjq/QGsJ+90rBiCFsxBIr34LBByEZuIYI4bPMdgX8r2vGxkD OaNtl1caOy2s/6Q0kWQ15uL3/Gaoa+ORzSuHZtCsgOpwtnPQyXeNVoAFvfO0qPineM BHV5wE1Hi3ON5AppH0sBkknp/dmYcSm1iY2+MGiJd22K/8Fgjq5zArzlo0FsUSpB19 OOJMqFjNHI+NLfN1sZ3oi2EeaX4R/p/3FtrMAuqEEMbAzXsz2pEF5AnTwruZj6pEs/ 0yssvKFDKB4+AStqrSSBERctINEwvYNiFSiu42ee+DZd4KB6aALo6lSlcKvv3EPeve c1jbPXJV153NQ== From: Will Deacon To: linux-kernel@vger.kernel.org Subject: [PATCH v4 3/8] arm64: mm: Implement arch_wants_old_prefaulted_pte() Date: Wed, 20 Jan 2021 17:36:07 +0000 Message-Id: <20210120173612.20913-4-will@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210120173612.20913-1-will@kernel.org> References: <20210120173612.20913-1-will@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210120_123631_424035_AE1D22FB X-CRM114-Status: GOOD ( 11.44 ) 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: Nick Desaulniers , 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