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: 13679364 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8381BC27C44 for ; Wed, 29 May 2024 18:05:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AB7826B009D; Wed, 29 May 2024 14:05:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9A3B16B009E; Wed, 29 May 2024 14:05:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 842AB6B00A0; Wed, 29 May 2024 14:05:21 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 697C76B009D for ; Wed, 29 May 2024 14:05:21 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 25924A0B00 for ; Wed, 29 May 2024 18:05:21 +0000 (UTC) X-FDA: 82172210442.21.FC748EA Received: from mail-vk1-f201.google.com (mail-vk1-f201.google.com [209.85.221.201]) by imf18.hostedemail.com (Postfix) with ESMTP id 58BA31C0028 for ; Wed, 29 May 2024 18:05:19 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=rKvtrdCV; spf=pass (imf18.hostedemail.com: domain of 3Xm5XZgoKCNE6G4BH34GBA3BB381.zB985AHK-997Ixz7.BE3@flex--jthoughton.bounces.google.com designates 209.85.221.201 as permitted sender) smtp.mailfrom=3Xm5XZgoKCNE6G4BH34GBA3BB381.zB985AHK-997Ixz7.BE3@flex--jthoughton.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1717005919; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=nPLVZGS8AMw+CagEZYqGOZQVma0bD0XI55fQjmFacis=; b=0QqNaeN3/MLLG2/vL3+9MTqQeWHi26bwcQ4Rk/wS6/+vKvknqKNlsyzl56ccv1pUZJfKTR IhnH3QF5+D90WCshv0+jomKCWMQptACy5mZnDH58OCz/shuWzgu9IFFb0YsK8zLOXrBNcS DzNZGSQG9xqNFvZV8TsQB00RLksSA+k= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=rKvtrdCV; spf=pass (imf18.hostedemail.com: domain of 3Xm5XZgoKCNE6G4BH34GBA3BB381.zB985AHK-997Ixz7.BE3@flex--jthoughton.bounces.google.com designates 209.85.221.201 as permitted sender) smtp.mailfrom=3Xm5XZgoKCNE6G4BH34GBA3BB381.zB985AHK-997Ixz7.BE3@flex--jthoughton.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1717005919; a=rsa-sha256; cv=none; b=Y8CwzcRCU5913e77oj+vO99ovC/1c8dnq+28UVcoL1GJdfe1IF51veSXVO+BaA8Y2KiH1W FoKJw+zqnSqEgExGXvoetpEyZaAEPEvkIdI/K+1bUyXBq7Q9MWSE+aonxtS3iQAkUhC/Rr yebJY0+yt1M1lmzPwoVigWsI0VRXn0I= Received: by mail-vk1-f201.google.com with SMTP id 71dfb90a1353d-4e4effa67adso21182e0c.1 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=kvack.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=rKvtrdCVRk2d3A51Z90Jf3Hibr6J81UH1ABrbLd88d6fZ7mFtHD/lilnXPDCKd88+W f1hTA79cNJbQZaVLrNqOWZA8RjNgxh7TJv5zZSoPyqSMJ7/2QFlTpPvhzQMJHcTvPlNH wi9qtsA2K5K2jSNJDolXHvck/YxiqdZO1+24/KtpGNzewzll+Gp9IBhJ2WErG8PP9wDM xcP2VpKZtlOJ784Acs0ZgETg/+pKBUJrS3r2FFkLC6F8IPav2x2tDEwkEwOXfxttw3q6 sWG3UdX7xHb6YHvD9lpz7t8UgqMP57ydX+vlZGY6pULSBs8SdIlsHqdjZcH+jgYN48BM wQTA== 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=L2z1v1AULKwHMtHgg5MwxM7LtiGx7Oc92v3vzEzQfHSzcDIB22CZEvccbhTx3tCoxB BfyAM9x3DK795cJmYytHeWkZ4k+13SSBCk75yCbZ8lmxbuFOhdZZzW/Jip6POdV1wlx3 9BnpW6Az15AxKVbxrQ9rUBYEXDSJ7CTTkEwS72LxCbLP9E3fHjvE2Rbwa+oJlH9Mkzpk MPVq9UGiBmtBgMEp+PQjiTkLbD9Pygq92r1nTHDPavAXyxoifzHiupD5JBRlQABIqTWI GIELVzlYpgULGUpvpHhC9g5emf5aDsKndfoi8i4cy3jowmr8emhupwuHTU2LgGBIxiD/ CRWA== X-Forwarded-Encrypted: i=1; AJvYcCW/s/yNbabmoVXcMFO7mX5X0BjlWzRBu3AA6S924vjbezXe0r7JegO40CO3gmN6kcrqHWUz9lUgpvjCYEDR9r61JBA= X-Gm-Message-State: AOJu0YylJ5R/TPEfluiaQ6gV+29JgXcWIlv4t9/6i/r/ww5dqWcNvi0e 4SffsmGBTh8X4KU5pKnLJsPSdoXyUkryVxvHnZnof7Ic8vOl1RGdPXmnuh910CzeydjS3nutm4d Van7b0RIh3MTnJ75E/Q== 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-Rspam-User: X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 58BA31C0028 X-Stat-Signature: 1ceep87u8w1xgmhoi4mhs8gabaoqtdw5 X-HE-Tag: 1717005919-61513 X-HE-Meta: U2FsdGVkX1+M9nLITi2TI/wd6106wFsAQuJL3fafEX7SeFDSMIkDhO1faiulYKgypc7PZ4mf4bWvMMmtU0jlf/o0CcO/VtaUGic6qAgiWd/BnXeSr9UdoJcwoIu45sGwnUffGLjn6eXQ9UOLUAFkxRlMLwfft2e2Fl9h8E81VwICVlkTI261297l2gfctBrhwE8YdJNO86fAfVktYnXRHX/UgtKF4la4T5JiaPo7nZ4JTunYQ7kc5zqOVWolyAVOWT5BTSqgl57G7m7O4ThgVLJfBOUcniyUNOId/4vxe/eO6B2WJgBNzzjah6rK48qWOaJmucHO5KpJUqr6dlWzFf+DLcY2lDMxBB8glLQLpyyIrbcJxLyMpz857No7TmuwY23SWGfX+Ai/aCjzJeGc9e2RBS6QrZ0AcxABF9r9uXCN0HuDSibIczrX7BjYbWhd6+gqRApJ+xc9ZQO71O/Sc/4Sh/Z2gyHzDkPLf8f3CNy7V6BfidEfiyzNGRfgHCyvKkgmOdzUPer8STLr1dw/zSgp+CI0fhqn+X67tnxaBheSaR46HHhnwq9Sw25zc9DnClcgx10yxud1mmgvYyitTZojiPZt16PitMgJGJZmawJv2K+fhuoN4pCnq4fxckqp3XTQvxBh37z+fynstk/VHOGDfYJwociP6ZR4RO4NDxNqz9Mt6BIUwNQqqsMAFrPos/oJoCtbcP6wKZgFjfk4XBMBmAUr9MsRpx8/00ERGgYf3c7KJGeNROchzTXjxjzFNFFmRQuU0CIw8sAQqE/qBPpJwHnrtREfJtNBIrfRFYmNK1UTg4nLlw1zy3WTD81Q4MFLymcdTC942nFd+viBz134m44LpXW8afQEyyFjrH9vs35GULH4p8hkn/9jTsTq3CEopSmIlaetmotXNjJ5Nrj1YJLqriUkYRIevZEPosNGLTwCcQOsVq+TS7NVZ7ql6sPQma5pcD5GO636ptx Gm/R6B3Z 7S7vLmU9vGj/DwnDQ0y2aQWA7Z9Isd8WJAUhwtxY78ucs4juE+SU31xax2smtGpjMqt/q4edbK54TEqcS/hfE9brgMZiPY+SwN0nPL8oH46wTeJSrYog1NABbE5NOb8gj6Huj5Zak4VOGR41LSkqh6LCcdkC8sdO0F3FbQ+DbvkBMI+qPRINEP8+QevgkRJVO9j0wQea6BQnrgK+iEo34BYITeahQMhsvQb/R6U1c3pV/6Ybe2ffPcPUehIF5FTW1Qcuij7ZeDib4aUDLIpqC/X9U4tuxH6EWs/v9noWAyvM1vIuS1hA6ulTl6o1df71BnLl77Oob6B4fh5FSTudsxn9eTQ15ciwqMZIJ1vl1J8vFnQHxzZs4xv7puGVlNCehTc9X5Ay1POjl4m30ByhxuOck1yaB6mW0uMztunEanwJSZgx3w1jB/I0Uvx9ykfDRnScbLNwqBpM6jhxKpNyYsmHVDL4/58wkP3lV6j9dJoybLM/Ki0RcyA3eCUm23kv/D0Nc20jWz694ZkW3WG6A+UcY1uIZcbnt8b9eqoneZSitpKMAfYrk2MSCqUM1F3Pzm9tK26c1oYkLMywUbAdannYFsfCrcbIO0r/B7oMwidFNq1VJX88Vj9JQshHKJTASxEUHDId2AWyk6uvHvj2bJYvCjrl4wCog6T6DK8aBYO9gJj/tJSn+Sd+eZg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: 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