From patchwork Sun Aug 11 22:49:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Barry Song <21cnbao@gmail.com> X-Patchwork-Id: 13759901 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 EB916C3DA4A for ; Sun, 11 Aug 2024 22:50:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 546A26B008A; Sun, 11 Aug 2024 18:50:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4F6776B008C; Sun, 11 Aug 2024 18:50:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3BE616B0092; Sun, 11 Aug 2024 18:50:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 1CA3D6B008A for ; Sun, 11 Aug 2024 18:50:01 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 9023014065A for ; Sun, 11 Aug 2024 22:50:00 +0000 (UTC) X-FDA: 82441458960.18.AC528BB Received: from mail-pf1-f177.google.com (mail-pf1-f177.google.com [209.85.210.177]) by imf18.hostedemail.com (Postfix) with ESMTP id CF99B1C0002 for ; Sun, 11 Aug 2024 22:49:58 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=GqrOmJaD; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf18.hostedemail.com: domain of 21cnbao@gmail.com designates 209.85.210.177 as permitted sender) smtp.mailfrom=21cnbao@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1723416522; 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:references:dkim-signature; bh=JGMkurdIhUlG4lZOHHU4BXtHWTQSg+0p8cfOF2uLcpg=; b=YNt0iKXmbS+sJPXlAgSeoOL1ImR7Z+pP4hMFC9IAyRCKgjyOosrht3OUBB269J3Y9augn2 OLkgRTzK8tYx40kXwlG6ri5ataa0ltoxou0qjO7dQwUUcfXi/at2G280oVMlrfLnTx/3YL 9N7Zkk5Q+YFQT3kLX9URh0SWLeXqlrI= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1723416522; a=rsa-sha256; cv=none; b=GeDOk+HAm4k8vPbHQsHmcAFPv9qZqDgbtNK7K82/3u9/kg7DTSWI9GeslvNJbDBUCAJK+J 3aePoQrvG7lkHNZj1Gct52WrPDathZkxeXVQiM+G3kudYCe+7WqDz72z16vwFIyeHDqtF5 BNWN+msouzr3jq71jjTk4gZ4d2N6WmI= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=GqrOmJaD; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf18.hostedemail.com: domain of 21cnbao@gmail.com designates 209.85.210.177 as permitted sender) smtp.mailfrom=21cnbao@gmail.com Received: by mail-pf1-f177.google.com with SMTP id d2e1a72fcca58-710cad5778fso3087478b3a.3 for ; Sun, 11 Aug 2024 15:49:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723416597; x=1724021397; darn=kvack.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=JGMkurdIhUlG4lZOHHU4BXtHWTQSg+0p8cfOF2uLcpg=; b=GqrOmJaDASZFzB3xg5rdbSJchMf5WvWIjIsfG+Xb/AxfLRpgvssfNCmQ7uBuOF2eD0 34zhJ94hIZK5TsIxjvysQqbIL+UwT7S7kxJ+6EuBI9dAygg75m0wnckpc+b29Vn7ql76 Ug0tpt4WJY5J6V66Exl+/TAD8HfUz4tfNi7xecXeY3B3AS9+e2RLn5vXU9UjoGfV3Nlm dhQBviIy+PHqwV0wV9nDC21pg/YrujKrg0a/6HxoMXZ7e2hFsqZVxkOHqete5QBv63tH Np79qFFGlyp50Mgq/H4im4+U6qYqM7773Yq4X2R1k+CvVKNgREGHR8TuC16wBv9/hwaC EJhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723416597; x=1724021397; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=JGMkurdIhUlG4lZOHHU4BXtHWTQSg+0p8cfOF2uLcpg=; b=iIBwcabcieC7fTTWTUBYjEe/8nLT+lAEXRwulhPLHf7zBZFqcHC/179wvQhXrmHMkG rWax2iSI+4izRFGhwen3kb3nOGhc2giAueK22mLvkpD/5u4Icd6OgK6JCBgHH5kJuoKi 9ZmcfnN/qemzGEbwgcgoDJkXblCxc6pW6cShM/Yp6uk67TV1jpmOyMfoDn/sT+LiikXz mf0rGzIId3YhepXUC4RhSm5MH/IPBu7updi6hb9vUYy5z8LX5+4QW2IPi+KRFP9OKJ8H COK6y5dj+hGNfJ3FIv6HBWTaRW8ahkCrPZ+j7XVL+3b1YCwaKdLZDLrOMRyI7u/cIuwU YF+w== X-Forwarded-Encrypted: i=1; AJvYcCVLJ+tEwPMTap6DualFAT1UFCbY5JlbAwfAxm2t+bO5M2zSnpNAUT+cTKFn6Q3jpHT/Jot5WwaWR3Kpo30+azjkmJ8= X-Gm-Message-State: AOJu0YxoNgoszn78jB0Wbz0BjAKqWv9UNDk0Z4sUobz9Lf+n4aKQaZ3R bG1dTAGR3CPKjhOeEQhz6CxhgG/gioE20nXuHT5MqVALnkeDzBDN X-Google-Smtp-Source: AGHT+IE/NMsRaG0XrFEak/CPAmXm4dEMC0wESUuveUkRXgmeJd7QfDPnDY4/S2yQdmMUorWYFCVxUQ== X-Received: by 2002:a05:6a00:3d43:b0:70d:2a5d:867f with SMTP id d2e1a72fcca58-710dcae83bemr10627333b3a.21.1723416597346; Sun, 11 Aug 2024 15:49:57 -0700 (PDT) Received: from localhost.localdomain ([2407:7000:8942:5500:aaa1:59ff:fe57:eb97]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-710e5874ddcsm2822993b3a.28.2024.08.11.15.49.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Aug 2024 15:49:56 -0700 (PDT) From: Barry Song <21cnbao@gmail.com> To: akpm@linux-foundation.org, linux-mm@kvack.org Cc: baolin.wang@linux.alibaba.com, chrisl@kernel.org, david@redhat.com, hanchuanhua@oppo.com, ioworker0@gmail.com, kaleshsingh@google.com, kasong@tencent.com, linux-kernel@vger.kernel.org, ryan.roberts@arm.com, v-songbaohua@oppo.com, ziy@nvidia.com, yuanshuai@oppo.com Subject: [PATCH v2 0/2] mm: collect the number of anon mTHP Date: Mon, 12 Aug 2024 10:49:38 +1200 Message-Id: <20240811224940.39876-1-21cnbao@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: CF99B1C0002 X-Stat-Signature: p3jyuw8p5791njbu84pimjts7obb4bj3 X-Rspam-User: X-HE-Tag: 1723416598-59355 X-HE-Meta: U2FsdGVkX1/x6oAzntKatqbX38H96MHtWHjKY8AVIPbCPHJ0cpo1FU605LqACF4YWlmso7DL76w4jWvTpwp58oSLnXDlv2GBOc1xA8u6GqhMC3zFad8dFvZT8RtVa11GRod/lAT0l8/FBpwf5EHkrRWFMnYfHEzaK+pi7ybmhSuESrQx2bFRPniy1t6HWGIN6aciqVg4eDBZgPylOb/b2FRxJVUz0rRioQTQDZzDAFoXI2aPhypbpgd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rV/jkofnbJ/2E8086cEIvsxkhcAgIYmBHX3//U6kqkZkYDvYAFT6Z+DitdPFoXt8r1ay+x3iJdwS7RUplQAAUJyh8T9iex7HmbXaarMNFiRuXJx9an/bTrAKNEnfClF/893dkRY3vuG11 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000960, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: From: Barry Song Knowing the number of anon mTHPs in the system is crucial for performance analysis. It helps in understanding the ratio and distribution of mTHPs versus small folios throughout the system. Additionally, partial unmapping by userspace can lead to significant waste of mTHPs over time and increase memory reclamation pressure. We need this information for comprehensive system tuning. -v2: * don't rely on rmap to implement - 1, uses folio_free, split etc. Thanks for David's comment; * rename sys counters and refine doc. Thanks for Ryan's comment; -v1: https://lore.kernel.org/all/20240808010457.228753-1-21cnbao@gmail.com/ Barry Song (2): mm: collect the number of anon large folios mm: collect the number of anon large folios on split_deferred list Documentation/admin-guide/mm/transhuge.rst | 10 ++++++++++ include/linux/huge_mm.h | 16 ++++++++++++++-- mm/huge_memory.c | 19 ++++++++++++++++--- mm/migrate.c | 4 ++++ mm/page_alloc.c | 5 ++++- mm/rmap.c | 1 + 6 files changed, 49 insertions(+), 6 deletions(-)