From patchwork Mon Jul 1 08:46:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qi Zheng X-Patchwork-Id: 13717668 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 19ECCC30653 for ; Mon, 1 Jul 2024 08:48:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9B95E6B00A5; Mon, 1 Jul 2024 04:48:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 96BAF6B00A6; Mon, 1 Jul 2024 04:48:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 80A986B00A7; Mon, 1 Jul 2024 04:48:16 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 610996B00A5 for ; Mon, 1 Jul 2024 04:48:16 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 1C1EA140B94 for ; Mon, 1 Jul 2024 08:48:16 +0000 (UTC) X-FDA: 82290556992.11.2D19C63 Received: from mail-oa1-f46.google.com (mail-oa1-f46.google.com [209.85.160.46]) by imf04.hostedemail.com (Postfix) with ESMTP id 48D4940012 for ; Mon, 1 Jul 2024 08:48:14 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=eeIUmraw; dmarc=pass (policy=quarantine) header.from=bytedance.com; spf=none (imf04.hostedemail.com: domain of zhengqi.arch@bytedance.com has no SPF policy when checking 209.85.160.46) smtp.mailfrom=zhengqi.arch@bytedance.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1719823670; 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=rTUbQcnas0bLANV3VeS/cF6tFOZwLY6gcsxQegoCBbA=; b=VKtX9bFqT+b/1H5W5ilw5X7YlTj5SNzPQpqe80SkrEHxAmgOT3LObaHLiJ9ekiWGIUu9hz hf7TfiaIrsxwkTEgrfjUjMlQzeODM1NjDUWLWvFL8BTb64J7bQRuqNZHVqx0JpHDigiW2i vBLP5JglGWKf8cUjB1uS7VgATAduhfY= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1719823670; a=rsa-sha256; cv=none; b=zM5EHDj1xq6nfdwkcnd6rCAiojPXSZPlDPMiU2tHvi+x3QNy6ZNWrI0/FbJTyqK2nLhK6f U2D2OZiJRPcfu82iG1lffWX4gZ7Zd1LqOfbBlgd0b+h7i2O9F79uAD/J2iVRCla9vGg/2f 8yNNk3Uv4oZBsx5X42p/kXDN6xST55o= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=eeIUmraw; dmarc=pass (policy=quarantine) header.from=bytedance.com; spf=none (imf04.hostedemail.com: domain of zhengqi.arch@bytedance.com has no SPF policy when checking 209.85.160.46) smtp.mailfrom=zhengqi.arch@bytedance.com Received: by mail-oa1-f46.google.com with SMTP id 586e51a60fabf-25cce249004so441803fac.1 for ; Mon, 01 Jul 2024 01:48:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1719823693; x=1720428493; 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=rTUbQcnas0bLANV3VeS/cF6tFOZwLY6gcsxQegoCBbA=; b=eeIUmrawZl8W9T26YDi7xJldtdKDMRRYPB0CMInpQ9qW7UvoTvOFjGMi6YqTK6YBFL dHJdLsaSdm64ysMHWeodsZCcesnzs8srPpLBKF7SOVQ5HNy7VhQGUEQknl9O+Fi4BGZe bymqs1t9+GBGwpVZ0PxfzGMamvy14sW7g46hHXMZMxe69ItgN7FWVc8LQFERqcCDcMaX fUQTrxGF9EXrcw7GBAFxcxo9glaC8RFsPExbaIC+sxjDtOAClrCJMzyi+CBf+3aYPwQ3 NXeiBPbu84kz/0QAhGeNKq2kAIv8F2pHoPCYVcjSNfXMQN69wzNwdxcZoM6uHpQTNdVF R9mA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719823693; x=1720428493; 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=rTUbQcnas0bLANV3VeS/cF6tFOZwLY6gcsxQegoCBbA=; b=T2ZQAB28Z6Li9NfZ40Y54nKEun8a9tMEh+lwgJ3BGHR6FXHhbuzfQMfS3Zzv7yIHOQ /h5v+UPVsqEROOyi2nW/NaVN6bfJG9C8Z9OgzxKsnazBHUGOhNBM44eIVjzz6yKj1AHR ebzjY8F5CfhvyRL6uwnkuIuFt2up10O6KxkFWOIwIqOEtyQSLUPoKoJZhn5Gsa0miNZN 6dX5jDUE6L1dTHzBx4LalYKdL6/bjjzimsxLdIIGdgpjiAy5Jj5CbPwMICJbYu/9vP2M B8rX6O3TRHyShX44eXgb7ad/702cBSbFPQz5XBY+VIn3rDYn8ICg84CYVQ556N6wweIk 8OeQ== X-Gm-Message-State: AOJu0YxwnxU29tSrnZcwBs5dtjApKQqzAOjdYByFe9HqEE5jPWkl6Gje jtjA7VcQWl1gJDE2c0yu0HrfS5kK1IrsgKWAvUZQ+1GdW582ukWD0/2XWGa0RZE= X-Google-Smtp-Source: AGHT+IEOYbpAWZ9+Meh4EfekAHEexcqmS8rjkaDrl5TI+CElE2CSv6vBFMWBxumSSWmDWCJBhTLlmA== X-Received: by 2002:a05:6870:a511:b0:259:f03c:4e90 with SMTP id 586e51a60fabf-25db36a52edmr5197533fac.4.1719823693115; Mon, 01 Jul 2024 01:48:13 -0700 (PDT) Received: from C02DW0BEMD6R.bytedance.net ([139.177.225.241]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-70804a7e7e0sm5932374b3a.204.2024.07.01.01.48.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Jul 2024 01:48:12 -0700 (PDT) From: Qi Zheng To: david@redhat.com, hughd@google.com, willy@infradead.org, mgorman@suse.de, muchun.song@linux.dev, akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Qi Zheng Subject: [RFC PATCH 2/7] mm: introduce CONFIG_PT_RECLAIM Date: Mon, 1 Jul 2024 16:46:43 +0800 Message-Id: <58942ecf91fea0a62307e5ab848228142a1270ac.1719570849.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: rspam07 X-Rspamd-Queue-Id: 48D4940012 X-Stat-Signature: 5puu4b8yj1dswy3oizyb5fu9z51owuoy X-Rspam-User: X-HE-Tag: 1719823694-376589 X-HE-Meta: U2FsdGVkX1/yrAT767dmFl8uA52Dor6Nm2bripqFlERfQrdPk+vAhXm0gUBk/TS2q1TjMJASfd5nT7qkErnv4d3GPerHQrDVm91xsiklVcAQJhPy9QHOvmuF5rN84u9M11oAK9hDW6RTkfEFnSseEbwjetJOFx0QLt57V6BJl9uldfjNRl2PcAsLX8MmNc6Zv73eq8tSv7XUd7oANdNB7TkFNcVcLNKukTgfiDaUqtPDv9luthosn2w9wN1LLaX5xbpPfv1FXKEbofY14Nw6GWl5VuqzcQLUYzT660wR5gTHo0EleLRCGPmWk9rX+3NAuIvTehK36I6G56kqWpvAxVUsSSX/4rXDfzz009KUY5u7sjW2peL3IfFXXddFEERK6CFv2JicdSyJyjilzs4QNQtw1LibvmKnhdlRGvYn93IbsUCqxDI9ZKllg1VBfbIngrr1eEROWGDDcBMvPwSQuQztLaScwzLk/LqKle9fgO61hpgoFCHmTDlP7uVm5vBkMbQuuHX6+jic0jTVoAmz34bAdc4zapw/IFzhZ01ulKLki+CoKI0bQpDJkzGjUPsOBejd/80xetkSbmt6+hVLY60w+DycMvSNCuAmQ1eTFjl+udYLalFwepC54msCv5bf1ubdMPSq+ySNjH9C66MYnXlySdaqIqb8qGpqOMB5kEvsBCL5UW6FJhrYc0QjZmpW3DR8lydrtp16a2Io0UniEGn0DYL8f9eRBZRPttOGgrHnJZQsviRqvAyGtJqxF7h2SGOGs3CXmvdnOLvY1F+HAtW9VQjEjC7UjXjMOXWxkGiWQAquvtnnZxLNxO3GzUNVMHBeNBXLKq4l+MnmIujMWk3bLVhRvRsTRgQpyiN/7rup+grVny5+b9LHRi8IPiBYHNASF3RJaruQZh4R/XH52bWutquTWfBgFiKnsnC9No2L9WVJTl1Bl8slyyC3sN3O1Xdqom39D8bGbDynIie HuO8HMg0 iB7/qwhb+evmgQ894yg7XBrMUp+8Mgcy3wgLv9DcUD4riPyyarF8D6TfG/YKQQKNS62md4Ddk/fMp7FrMM8THHb/I0z98Ehf49lRGuJ11yzCQMy2/IjOGwNu9A4xaGQmHyoOQ2s3gM6NSYTb3NAnnon8XtSUYy4pxAGyKqL/CYMoCEIJPBO2QshOeKxkgDvSZp9UpV/1t4Nvbz0WZafuv5X+VHQow3BxlvTIbPMFtatz7FhNe+fcTY6SrsmOEYnD7eOCuUch0+oWrgf8eLuOSVW/T1U6yqJp4hCkm2o7PdaO2D7lCcbXLzcaHHE9kfvinXV4gjbixbCBXtinagXqZWpzkzrQABSR6o2Bw X-Bogosity: Ham, tests=bogofilter, spamicity=0.000004, 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 991fa9cf6137..7e2c87784d86 100644 --- a/mm/Kconfig +++ b/mm/Kconfig @@ -1256,6 +1256,20 @@ config IOMMU_MM_DATA config EXECMEM bool +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