From patchwork Wed May 29 18:05:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Houghton X-Patchwork-Id: 13679382 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 D7576C27C44 for ; Wed, 29 May 2024 18:05:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:From:Subject:Message-ID: References:Mime-Version:In-Reply-To:Date:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=HD2Ut5cqWseRISvpvLTzPFe5gwcCLGQgkH9kv/M9iB0=; b=0VUnf5uCshuu+seUnLt/3W7LcZ BGVl0Z0H4DTcY+6PFBgBdYvV959BoCh2/aEB4q4jonmF7X6PEZQHjC0+bJu84zHRXFWqVgiuuGEyU ZAXMzWVzJ7BM5dLuVKs8ZyJedkL5Z/wbxuQpv4CD0LHVryfh2vQ623cqnj2SCwN9yOh+t6gmXoOeF lzAfRRMlO8SwbVd0tLNjKdiuYxTmmOvNBtLkwnVXrXvoZlLScWy4K5bc5omD5OzKdKJ1znKsd3hDg C6Kwah5XJdX2pH/cwhsrYR/ElRAvUoXDQPmzytN7BE20wemSSH5VSDWhNywn61mOIwbdn2cF6VPU+ cZtx7Rkg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sCNg1-000000058pI-3zhI; Wed, 29 May 2024 18:05:29 +0000 Received: from mail-vk1-xa4a.google.com ([2607:f8b0:4864:20::a4a]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sCNfu-000000058ha-1Q05 for linux-arm-kernel@lists.infradead.org; Wed, 29 May 2024 18:05:24 +0000 Received: by mail-vk1-xa4a.google.com with SMTP id 71dfb90a1353d-4e4f007b7beso20152e0c.2 for ; Wed, 29 May 2024 11:05:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1717005918; x=1717610718; darn=lists.infradead.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=nPLVZGS8AMw+CagEZYqGOZQVma0bD0XI55fQjmFacis=; b=UmxKPS0c0fohYeRBfe0k64qc4eo8AGM+nYpSdMg+TkGdsFoVq/MUpvskaMLkLEo4eO kloTeH+ji38OZvpfj1vf8f2HS4EQeDLpAdx+CMZMQgXqrI8AqrhZwMnd07IFGXumHS/5 lP0vg2tq2SbybXCYvhWfGwXqyRMj7o/GsYH7Yf+iY8Vo9hbbhCLnTla5IZ8ByWFgKary 4L4qpSJ6g1CwTQRBIvkYI0alVROZMpjKI3p6e2f8GMaIsaJwDF76TnRntCqM+1COWtU4 LcMo82B40mjQ9UBtBk0B8fm4FJ5ye0wS1A/JWUV7hBg1pWfD5cviwD5pCcS6cpjm0J7n M1eA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717005918; x=1717610718; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=nPLVZGS8AMw+CagEZYqGOZQVma0bD0XI55fQjmFacis=; b=BGSQ7yqbH76CBFoKc+jY1yJuXbvX87q24fph0y+WLx+lb7jKZTwaMPDA4ZeGf4kETi Os9VeQCVGDpc+CncDGUubRtHJkKsyDNpe9yn1wBu8s1Bc80sXMmTez7Ar1NHwrZQ8JiJ pg5ujSa2vBCWSklDpna+wICy0fOK4iGxDxUNf0kGejmvR7eXz0kmj3xCqPfQOBX88uLC FrloAs5QUdrBsMzNBbEg98cHvUZPPHafF63neTrssi7hdzT9MdhCZZMRkZ3ApUIozDwO SXrabOvPTM4pxqoHFT4yOK9M4TKroypNtkimdnSqMBfYYTolUp5vTxajr/bgDVulVx7R BErw== X-Forwarded-Encrypted: i=1; AJvYcCW4CWE3yC68cLlnNtKbUJW8Fz6+PL092IfzzYeEYzoRbzDOHhido7VSvcOIinjDsPZ7eB15M9+/l/trBDg5TvF8uVSZRUKwHnTxLwQVLPGSpePxSQA= X-Gm-Message-State: AOJu0Yx8wnxHlMRBMVzkT7QazZmrApQTj2Il4ffN9TunOB9bHnizYLwk VDZqr1Qq8lS30jWWSSNiuy8yGAjFmO7kcevryKBb+2K3Ge8lhUrsPGonjzAfEVlouIS7FycgECa pViU0A+nJTecTh7M7NQ== X-Google-Smtp-Source: AGHT+IHYErK4IEAw4AodIy6/uS9D/1KylfkBeNLUgQvcCMlB4bZF6bJgSfUsGpPUaVK45i5PNzhTyn3VxbK8rZqg X-Received: from jthoughton.c.googlers.com ([fda3:e722:ac3:cc00:14:4d90:c0a8:2a4f]) (user=jthoughton job=sendgmr) by 2002:a05:6122:2006:b0:4d8:797b:94e0 with SMTP id 71dfb90a1353d-4e4f0112182mr502860e0c.0.1717005918294; Wed, 29 May 2024 11:05:18 -0700 (PDT) Date: Wed, 29 May 2024 18:05:04 +0000 In-Reply-To: <20240529180510.2295118-1-jthoughton@google.com> Mime-Version: 1.0 References: <20240529180510.2295118-1-jthoughton@google.com> X-Mailer: git-send-email 2.45.1.288.g0e0cd299f1-goog Message-ID: <20240529180510.2295118-2-jthoughton@google.com> Subject: [PATCH v4 1/7] mm/Kconfig: Add LRU_GEN_WALKS_SECONDARY_MMU From: James Houghton To: Andrew Morton , Paolo Bonzini Cc: Albert Ou , Ankit Agrawal , Anup Patel , Atish Patra , Axel Rasmussen , Bibo Mao , Catalin Marinas , David Matlack , David Rientjes , Huacai Chen , James Houghton , James Morse , Jonathan Corbet , Marc Zyngier , Michael Ellerman , Nicholas Piggin , Oliver Upton , Palmer Dabbelt , Paul Walmsley , Raghavendra Rao Ananta , Ryan Roberts , Sean Christopherson , Shaoqin Huang , Shuah Khan , Suzuki K Poulose , Tianrui Zhao , Will Deacon , Yu Zhao , Zenghui Yu , kvm-riscv@lists.infradead.org, kvm@vger.kernel.org, kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-mips@vger.kernel.org, linux-mm@kvack.org, linux-riscv@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, loongarch@lists.linux.dev X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240529_110522_449387_46B0791F X-CRM114-Status: GOOD ( 13.29 ) 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 Add this option so that one building the kernel can choose whether or not they want to support walking the secondary MMU. We want users to be able to blindly enable all lru_gen features to have the best possible performance most of the time. Walking the secondary MMU is mainly useful for be able to do proactive reclaim, and it is possible that doing this can harm VM performance. This option should be enabled by users who run VMs and also care to do proactive aging/reclaim with MGLRU. With this config option enabled, a user can still disable the new functionality at runtime through sysfs. Signed-off-by: James Houghton --- mm/Kconfig | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/mm/Kconfig b/mm/Kconfig index b4cb45255a54..3ac4b1dbf745 100644 --- a/mm/Kconfig +++ b/mm/Kconfig @@ -1222,6 +1222,14 @@ config LRU_GEN_STATS This option has a per-memcg and per-node memory overhead. +config LRU_GEN_WALKS_SECONDARY_MMU + bool "Walk secondary MMUs when aging" + depends on LRU_GEN && LRU_GEN_WALKS_MMU + help + This option allows multi-gen LRU to walk secondary MMU page tables + when aging. This allows for proactive reclaim, but this can reduce + overall performance (e.g. for a KVM VM). + config LRU_GEN_WALKS_MMU def_bool y depends on LRU_GEN && ARCH_HAS_HW_PTE_YOUNG