From patchwork Mon Aug 5 12:55:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qi Zheng X-Patchwork-Id: 13753584 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 7AB06C3DA7F for ; Mon, 5 Aug 2024 12:55:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 10F016B0095; Mon, 5 Aug 2024 08:55:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0BF266B0098; Mon, 5 Aug 2024 08:55:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EA1656B0099; Mon, 5 Aug 2024 08:55:58 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id CA9BE6B0095 for ; Mon, 5 Aug 2024 08:55:58 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 6FEF51A0279 for ; Mon, 5 Aug 2024 12:55:58 +0000 (UTC) X-FDA: 82418189196.18.94D1F07 Received: from mail-pf1-f179.google.com (mail-pf1-f179.google.com [209.85.210.179]) by imf12.hostedemail.com (Postfix) with ESMTP id A32B24001F for ; Mon, 5 Aug 2024 12:55:56 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=M5ukeAPO; dmarc=pass (policy=quarantine) header.from=bytedance.com; spf=pass (imf12.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.210.179 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1722862506; a=rsa-sha256; cv=none; b=L0ICP/U7OIRvQCT0omMtV4pJoBs0cYW5PIRV36JWzClA6hVcsawtWjjHXeb5OKJ9gbMOPx wlMDELkl7Aiq3AzlzgEaI5GTbvVy6AzqShWmIvG5bU+56IYrxezB8bkstGARb4PxIq6ExK vfe5g4NoB1YS/4fB+TT5RqojiDUmFA8= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=M5ukeAPO; dmarc=pass (policy=quarantine) header.from=bytedance.com; spf=pass (imf12.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.210.179 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1722862506; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=omYHK4YJqVuB4cm7/RSntivvxRLai4c0fyHEJvres6w=; b=cW7BYFj/9+pFC7kWIicc8b8WClCII5qB48ZUwRw8v9H5ftLCyTztD1Q5TU8gq4k4tDKcX0 lh2H4V4vlWpegGorVXlqxgW/Cy7YWg4tpdIa9iF9FOqAaTBYymj7pkldi7Pirzz90VygFF I8qo5C7oNG2nYOYO7g8fzt1Ww+q7hrc= Received: by mail-pf1-f179.google.com with SMTP id d2e1a72fcca58-70d1876e748so1305757b3a.1 for ; Mon, 05 Aug 2024 05:55:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1722862555; x=1723467355; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=omYHK4YJqVuB4cm7/RSntivvxRLai4c0fyHEJvres6w=; b=M5ukeAPOUavRHirJneEYgdQCrAtgxPkkz9s6SpAbGIp0IFM79kwoGDQicTSvvLSBxq lpxnVWWLGMe43N7tfKnEbyO3x+OZL1yyJnnC7PpMI8JV56kEnCaICkfL0+q+MiLPJiOc 2eHDoQbQpUvASb/FJoKlengTZpYRXQE8Nzppjrkou422OUm+GYZ929CiwOmiBhI5+8Wi VL68EAhUqXxCP2fXMZEefWf88ioKhlGePvBqjqpPkysqUgOQeOf38XJ3DbBR50L+/09E EoKyLzTWr64ul2wzn0ByRMF/s3t7H/NUrezQxO3LY1gXqSVh3PkFbSTCE9A8b1Dun8RZ vxLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722862555; x=1723467355; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=omYHK4YJqVuB4cm7/RSntivvxRLai4c0fyHEJvres6w=; b=Ff+BW0ibrs1iMy+MCJNRwa7jL0oN1DMSQRfRrSk7DzNMWCEiutQ6LSzgZRiBWzWz1q SYwZws/bZDYbbR+WJ5cptnWxUZ90HKEeKUuQj++Ze4GbiU19C2BhQdLiGWJH0XaC1L56 HL4qToRsnZC4iusCCXAJvuvq2DjhNx/6oNoqoYFu+dU+jz9FM/J9jnsD7OJ75XSx8551 NOOuzSZUjVOUI48UtlHGDwo/ZlsXsnedvNKXPicFp3ZwCXX8iW1p/KyO6Wdqf3cdyRIB WIf05GPfoNPvaX8G90gT7b0hFCQLQ28DDpLCD1smXwRtzMDErlX6HICp71cEIUY8j4it k97g== X-Gm-Message-State: AOJu0YxNITf+1p0tbiFu/xrXHzPpyIWfanCTQtkNyN20c7DSt50S8AMd ixcqsrCxGjIkVex1esM9A/4j8Q2VT6tyhdg8g3pfl6BcbzvMp7Kbl1hd+wfKVCo= X-Google-Smtp-Source: AGHT+IGYYukG+ok6MYSzTAxan5mNsM3B2kkWkuJBYY1IjywvHeK1bY7aqXgLyTgGlf83PVoHS2ooMA== X-Received: by 2002:a05:6a00:21ce:b0:70d:2c09:45ff with SMTP id d2e1a72fcca58-7106d0927eemr9121873b3a.4.1722862555191; Mon, 05 Aug 2024 05:55:55 -0700 (PDT) Received: from C02DW0BEMD6R.bytedance.net ([139.177.225.232]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7106ecfaf1asm5503030b3a.142.2024.08.05.05.55.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Aug 2024 05:55:54 -0700 (PDT) From: Qi Zheng To: david@redhat.com, hughd@google.com, willy@infradead.org, mgorman@suse.de, muchun.song@linux.dev, vbabka@kernel.org, akpm@linux-foundation.org, zokeefe@google.com, rientjes@google.com Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Qi Zheng Subject: [RFC PATCH v2 2/7] mm: introduce CONFIG_PT_RECLAIM Date: Mon, 5 Aug 2024 20:55:06 +0800 Message-Id: <7c726839e2610f1873d9fa2a7c60715796579d1a.1722861064.git.zhengqi.arch@bytedance.com> X-Mailer: git-send-email 2.24.3 (Apple Git-128) In-Reply-To: References: MIME-Version: 1.0 X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: A32B24001F X-Stat-Signature: z9rxew1auibu7mcbiw9sj358er8jjohz X-Rspam-User: X-HE-Tag: 1722862556-613415 X-HE-Meta: U2FsdGVkX18myk2h+Hr57WWRcA4Ma4o8+PUjHKO/RnMlh9lsa3Rg7TLg3aNefaAQ/wqPQX4nwWuddgEAM7GIStmljyT8KSbJqCV7Yu6GS6yFmzoGVeMEw0Byx10xYqT6QFm63e7LCWw1i2AfUw50FLBDk6U4XXKI/KtQ3zL4Sw8kImFI2f1w0Hfmf/tsE3HC72FZDMBs4n5VCwxLU2PzDWUgqd62cNCRcRJibCI2ZJNuDubrJSmFTmTYzC42x9BkxwXiAp8Z7V7vdgnPGvOVNRIVSFLUhC6ryceYwvZBZpwuz/Gpw2YT3nKUKpZSyUzcnnlYX81QtGYH3SfFSEWOpBE5W6k7WTmWKn9ryTYYkzRQcbSyy0Q0F8/2+Oms3kCheXHfeifDl9nd8EhxaHzUKobsELDMuPwYDOIBhEv2wtFTI1iL9bbawkLXpLkoD20HKj364/E8bG4Egc2tgt4sncT7TqeCzMprNKg+GJ+O7cUzyHdTLfKeL520PnO0i8Nc0NQqJExUz1K32G93WKUba6IjKhqcY0cD7C/h+u+2XzbpXRyuklRGeNQiZ9HfDnum8W2IBvPUNWsdM9ap0FDzLKREXMKr40+pAK74MpMhNGHZDbh0qNgdsvpQhd6slfYyrQoBzVORr+r/tuTBaxqm9eGREJPR3mjfdwfGm7xMxlZwS5ydyLKCQTEG2JZ3oCvDh5iDulj3PrJsnwvM16Dt/3kKtc7dRP71B/vn1R1u9sMFdh7MtAXtQb/XKYvsY3C5ncJoZSGawmvER5SEVRz1uCROXjHAS5vcsZrcwFSqK6pUV8iBEZT5C/hJO5ScxGNz7qxIlRi8FGJFwkNHfHGcZyVknduxCAgBcahvv818BUslBqYYhcMR/qzkeFSjpCh+ZtX9pgmii0jSdWQVu/YsGo0mSreLJuaIj/u+efDrdsFickQ6jYD6bt/yeMibvVgWqkpWoBkzfvvXR8T9vmS gh0F38cp ayGgKK5yap5PqIg1O6KrbfyTbEakUU4OfCMIQOyytE8oE8rm9JPTJv2i9R86V9509YsVNKd8SDxTyGkk7V/rQtZGuJeF+NnbRavNGa1TD1Zxz+R7aCWuCiOTvZOWwKq/SrkpdD/sMoXsi1LvctRj8j0f+ObMoBrG3s4txdBBjH4q3uIGTysp0Lp4/a8Mcvc4VxPhF3/t2FybB9UFLGBJqDQmNG4G0R8nCYNew6TsUDzSOy7JiX2LvaInyFEgqIP3JoHYPPPQJs159UgY6uUhkcanKDmDX5MQN0uTMfz8EGNUrElV3KHCWoVsmmS7Tjyz7P1jIC7/esogti5jto24BrIKaSozk/npcJ2yzGwewidiMVVmPrTNudn8orw== 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: This configuration variable will be used to build the code needed to free empty user page table pages. This feature is not available on all architectures yet, so ARCH_SUPPORTS_PT_RECLAIM is needed. We can remove it once all architectures support this feature. Signed-off-by: Qi Zheng --- mm/Kconfig | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/mm/Kconfig b/mm/Kconfig index 3936fe4d26d91..c10741c54dcb1 100644 --- a/mm/Kconfig +++ b/mm/Kconfig @@ -1278,6 +1278,20 @@ config NUMA_EMU into virtual nodes when booted with "numa=fake=N", where N is the number of nodes. This is only useful for debugging. +config ARCH_SUPPORTS_PT_RECLAIM + def_bool n + +config PT_RECLAIM + bool "reclaim empty user page table pages" + default y + depends on ARCH_SUPPORTS_PT_RECLAIM && MMU && SMP + select MMU_GATHER_RCU_TABLE_FREE + help + Try to reclaim empty user page table pages in paths other that munmap + and exit_mmap path. + + Note: now only empty user PTE page table pages will be reclaimed. + source "mm/damon/Kconfig" endmenu