From patchwork Wed Aug 14 09:23:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yicong Yang X-Patchwork-Id: 13763173 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 372FBC52D7F for ; Wed, 14 Aug 2024 09:36:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Message-ID:Date:Subject:CC:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=WuQJlRik4BZ4hVsHwtegF3hmNcVvJybl4g9KxCGkWKI=; b=0jK9rvSs41L/+Ic1BotJewBkYh ir3Y5rFe+urAlVVz6PFGg8zFyv95FjJD48sXswsDwc/rUYeezDH59GDuD4HEpvBC9DL3wAK5tKxqP +Cy1xAiCgMsqw/QR0yVG2JdmNePsxOq7RpRTt7CPIBpNKZ82kTE4WZ19tgOhf9IpqJKpAqjiIzWwC BFdkDdrz0QpUhJH6uh8MdUDulG146xGa6cgoP59zzsaxmjnd8uM7ok9NqCDv2O+uBPDFIwQI2FV7S oEVKiVolWL65JI5ADDcgPwfiHXMIEFN7vYkML04iCSwX0E95ImTN71dkiZwLYj0pwDTGXfoIcA4fW CM/Fu/QA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1seAQL-00000006QEb-2L9N; Wed, 14 Aug 2024 09:36:09 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1seAKd-00000006OVN-26jx for linux-arm-kernel@bombadil.infradead.org; Wed, 14 Aug 2024 09:30:15 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Type:Content-Transfer-Encoding :MIME-Version:Message-ID:Date:Subject:CC:To:From:Sender:Reply-To:Content-ID: Content-Description:In-Reply-To:References; bh=WuQJlRik4BZ4hVsHwtegF3hmNcVvJybl4g9KxCGkWKI=; b=QXtYirSg6U2kMGcTT0DtX9XAql J0abK0FGGTV2vAWeb69c2ri+TFuGTNmYD28etrvh1DtZYfWNll2X0MhSe36hrdUY7vKNSASF/qVAg UWaalPNl0BMWdDgvGQfGhWV9NYofo77KeaRLMcLgDN9yo5m0IJkhVdr++m/r8+MPQu5KBYZ5GqxQL 3yQ3bCkdr2EbxJ9TUD255EfDd005B8KYhDdgiWb42DSJCgj20ngR+DonTPasSvJ5DEKNsCfeyRy6p LkC5pL4u7j1H/pRbAsnWvA6Mop6nFJx7yEld9hObKMiYhFLmg75/dEO9qZFlBfCI3Q+P44IyeOPjl K9bEICCA==; Received: from szxga07-in.huawei.com ([45.249.212.35]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1seAKZ-000000080Tv-2Ezi for linux-arm-kernel@lists.infradead.org; Wed, 14 Aug 2024 09:30:14 +0000 Received: from mail.maildlp.com (unknown [172.19.88.163]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4WkNBc6j3Hz1S7sW; Wed, 14 Aug 2024 17:24:56 +0800 (CST) Received: from kwepemd200014.china.huawei.com (unknown [7.221.188.8]) by mail.maildlp.com (Postfix) with ESMTPS id 32B9F18002B; Wed, 14 Aug 2024 17:29:49 +0800 (CST) Received: from localhost.localdomain (10.50.165.33) by kwepemd200014.china.huawei.com (7.221.188.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.34; Wed, 14 Aug 2024 17:29:48 +0800 From: Yicong Yang To: , , , , CC: , , , , , , , , , Subject: [PATCH v2 0/2] Support Armv8.9/v9.4 FEAT_HAFT Date: Wed, 14 Aug 2024 17:23:31 +0800 Message-ID: <20240814092333.7727-1-yangyicong@huawei.com> X-Mailer: git-send-email 2.31.0 MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To kwepemd200014.china.huawei.com (7.221.188.8) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240814_103012_360664_31466EDB X-CRM114-Status: UNSURE ( 9.90 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Yicong Yang This series adds basic support for FEAT_HAFT introduced in Armv8.9/v9.4 and enable ARCH_HAS_NONLEAF_PMD_YOUNG. The latter will be used in lru-gen aging. Tested with lru-gen in below steps: 1. Generate a 1GiB workingset by `stress-ng --vm 1`. Then hang the task to stop accessing the memory. (AF bit won't be updated) 2. try to age the memory by /sys/kernel/debug/lru_gen Run above steps with LRU_GEN_NONLEAF_YOUNG(0x4) and not respectively (switching by /sys/kernel/mm/lru_gen/enabled). LRU_GEN_NONLEAF_YOUNG will clear and test the PMD AF bit on page walking for aging, otherwise will clear and test the PTE AF bit for aging. In this case LRU_GEN_NONLEAF_YOUNG will improve the efficiency of page scanning since pages won't be accessed and we don't need to scan each PTE. Observed ~40% time saved for 1GiB memory on our emulated platform with LRU_GEN_NONLEAF_YOUNG. For lru-gen aging: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/admin-guide/mm/multigen_lru.rst?h=v6.11-rc1#n94 Change since v1: - Address comments from Marc, improve comments/Kconfig, clean code. Thanks for the comments. Link: https://lore.kernel.org/linux-arm-kernel/20240802093458.32683-1-yangyicong@huawei.com/ Yicong Yang (2): arm64: Add support for FEAT_HAFT arm64: Enable ARCH_HAS_NONLEAF_PMD_YOUNG arch/arm64/Kconfig | 20 ++++++++++++++++++++ arch/arm64/include/asm/pgtable.h | 14 ++++++++++++-- arch/arm64/kernel/cpufeature.c | 26 ++++++++++++++++++++++++++ arch/arm64/tools/cpucaps | 1 + arch/arm64/tools/sysreg | 1 + 5 files changed, 60 insertions(+), 2 deletions(-)