Received: by 2002:ab2:7407:0:b0:1f4:b336:87c4 with SMTP id e7csp277899lqn; Fri, 12 Apr 2024 00:38:06 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVL3TrWpMybeo2JDJQHPduwLOD0V7UuASaZJD8SS9yTE0zrq3CCXcYAnEkR4Z5ajiHyq8JpZvgjBRYZuEHaDxzXFrP7/XU+5oRr1iIPMA== X-Google-Smtp-Source: AGHT+IGGiqQUy0wpcI93FEnYBIOHYy8/R3/Y8fFX7/t7k5QBZ0ofWCVLWO8Xwl9yyKg3vN8uUrpL X-Received: by 2002:a17:903:18d:b0:1e5:866a:c04 with SMTP id z13-20020a170903018d00b001e5866a0c04mr1692348plg.42.1712907485570; Fri, 12 Apr 2024 00:38:05 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712907485; cv=pass; d=google.com; s=arc-20160816; b=evCH6/rI20ysBkt18XNwVRSTlWCm+tZus0opvkGotLTDVJIVfo6ckFfot/uqh1D+bU FfbyPE0CkSxhpg7oRfc6tGiCbGxKOdamC5NzZ/m5FpcsF8TKaCunO5BJKdHamPHzfXHt SUn2aOzj+jg5N5SC7NT9dzfEw7P4lmitjGyb9DKqdjkT2Djc83/hV3KKsCiyeCBUI+11 o3sU+Uw+rmrwQorfOXiv71HDM+VxWptAPUAtbwAF8CAvzvP8dBlqItfJW+6lQBW4Nopg zWr8jluqzohIhb3krqpFxiqFhi34xOmgfkzHKLTjIdT0x6E2vpzmMHUfkjGIIfxzwJJm DeqA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=i8Uou6ceHlqIama13YYiFU7oji+lihhby0gYb2Jomk0=; fh=jprdCENh+xyuP8chL1w9B4/dEcfVnMoubj3r6DzQLpM=; b=u5LFJelR9+/1RJtX8Klv3VXa5ybUuzwSQ/Y3iF7i4oaGmZQoZ2anjmIf3Hsf6w+liF siiGDRaYE1UdEaDl+2LEwIiNfjlgbPBwzkw9hM1YFTlFvsU+m9a7W1rrAyZXSzfBbkms zE0P+HUBWFrUh5yZifFHgjVzjpJkCFgSJgJH+zjilrhsFZfKIUPaD5H3AAMVH9OmEnCf zzBcjTdNBrepGrYwcadQ9FdriEJa+NfNzppYdCt9+xQf8tZFaZWATYqGkTeI+dBIgqPm takVPEHs9J7JHtDGNHlf+/cUohUAdcJeXNUMYgms99Rj00pINaF5HKTYODcLqyMmYYmy bL8A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=JBym2JCC; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-142159-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-142159-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id l16-20020a170902f69000b001e197cea248si2732503plg.607.2024.04.12.00.38.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 00:38:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-142159-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=JBym2JCC; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-142159-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-142159-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 45E4D287039 for ; Fri, 12 Apr 2024 07:38:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 532B24CDEC; Fri, 12 Apr 2024 07:38:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="JBym2JCC" Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3B2131B5AA for ; Fri, 12 Apr 2024 07:37:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712907480; cv=none; b=htBTtjahy6k27qTKWgKR1slZ4E015QqT0cbIK7kKgTGysZnc0C3gqMUFVnSqQMlBiLUuEya0YdHMXqjXMYB0NU3fprmgibaSiiRHPIx1Y4PdIsEbIc+rmVlLsId65q1iXhI7vEfbmgqk19kFz6a+AFh4jFwZzkXey0aSdqdyHLQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712907480; c=relaxed/simple; bh=6sqzzhJkpUQDFb0NIOIGCwLMbM60sBT/lKp5mFA9t4Q=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=FLiZri2ESe628ZiI/6diw7nNzypKhJwwadNom3izXolg/mOmo0A8XG6tk/x/unwvZg+wDEPYsvHGbfPnqphBc2EfbZApYv9t6CXmnIRZLnT85pQyqi5TNUigw2FUU4iT/nHsbpTCZ/o1pGzJvflssuygL1c/3xuIp81bOrmlD9s= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=JBym2JCC; arc=none smtp.client-ip=209.85.214.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pl1-f172.google.com with SMTP id d9443c01a7336-1e50a04c317so3863545ad.1 for ; Fri, 12 Apr 2024 00:37:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712907478; x=1713512278; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=i8Uou6ceHlqIama13YYiFU7oji+lihhby0gYb2Jomk0=; b=JBym2JCCpjr3Eeu9UPPvt0qnducKWyuNA4TegAJEv7v55earChEUIgdstfhfQOGoL1 JvXrbmWZbA5JkLEdmM6vyUb2FgWvDTmBPm3yTeVptseOb83UWMPT47bm8eYDwLr45Jgf zZILA9otOQlKztqR2DPv2F9kzGQijRrIelqvXZ9gFvtQkPiOu2aUlsuq4xo3TtrscYbL qHyIKdQbL6/xXgLJ2PyH3/FFmCnqabmKOWMMOChfjCeVB5yvJM9jrCAf0Q2+cXiU2VQ3 xQ1w326DcJfk0UJLzGFcRnXAwTGg+CeoYSuVVAYaYFWtVVvyAacAkyrNZGoglnL60O0Z V3sw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712907478; x=1713512278; 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=i8Uou6ceHlqIama13YYiFU7oji+lihhby0gYb2Jomk0=; b=R4iWZMQ4ZDkwM2qaekaPcLEByYpPBloOVjJpveZdMcIuFCacWq1MbQV2rwoE8CI4gr fjcEX8Dm1DInMjzsd9zgn03UbX5AfsJC9+oz3+etIh3tBa75PpvVw/gCEw7vG2oXgdY4 xa+E6lwrq/EEjPIpsyYMbEI2PrYXhZesxcuAq9JjfH9ix4YNqAr13BSSyCuW31AjKzch c57GruAvIaLnJB6toD+CFP7CuQDzZAshG1Y4WaTw0MS6X+BVBvLlKEs2ETAM62rv2KUJ QFVVTc5U0TgFaYPZDf6IirHwRRyL/CbBuK/IlccRn4l1m7NVc2Dk2DYY1WoTDHIiHqpj nMjQ== X-Forwarded-Encrypted: i=1; AJvYcCWesJPQRN+8CMg6K4ojSAGA6rggzViK31H5uTrJsjtgI57Ey8/TkmruiPwdg2R0jOef2vy8SCsZBfqYCP3npuFZbqsZDnqOu8BNLJZD X-Gm-Message-State: AOJu0YwtV3lajKZyzPsUxokVx/3/6G+gP3iNogIHpxxbFRzDtGrkhvAZ tWuTEFzzMHK4utAMFqJQ2Z7CdVoR3HWBoQptc47hrAKN7qUBQ9fB X-Received: by 2002:a17:902:cecb:b0:1e4:2451:c2b5 with SMTP id d11-20020a170902cecb00b001e42451c2b5mr1895200plg.13.1712907478445; Fri, 12 Apr 2024 00:37:58 -0700 (PDT) Received: from localhost.localdomain ([2407:7000:8942:5500:aaa1:59ff:fe57:eb97]) by smtp.gmail.com with ESMTPSA id n5-20020a170903110500b001e478f359bdsm2344011plh.127.2024.04.12.00.37.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 00:37:58 -0700 (PDT) From: Barry Song <21cnbao@gmail.com> To: akpm@linux-foundation.org, linux-mm@kvack.org Cc: cerasuolodomenico@gmail.com, chrisl@kernel.org, david@redhat.com, kasong@tencent.com, linux-kernel@vger.kernel.org, peterx@redhat.com, ryan.roberts@arm.com, surenb@google.com, v-songbaohua@oppo.com, willy@infradead.org, yosryahmed@google.com, yuzhao@google.com, corbet@lwn.net Subject: [PATCH v5 0/4] mm: add per-order mTHP alloc and swpout counters Date: Fri, 12 Apr 2024 19:37:36 +1200 Message-Id: <20240412073740.294272-1-21cnbao@gmail.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Barry Song The patchset introduces a framework to facilitate mTHP counters, starting with the allocation and swap-out counters. Currently, only four new nodes are appended to the stats directory for each mTHP size. /sys/kernel/mm/transparent_hugepage/hugepages-/stats anon_fault_alloc anon_fault_fallback anon_fault_fallback_charge anon_swpout anon_swpout_fallback These nodes are crucial for us to monitor the fragmentation levels of both the buddy system and the swap partitions. In the future, we may consider adding additional nodes for further insights. -v5: * rename anon_alloc to anon_fault_alloc, Barry/Ryan; * add anon_fault_fallback_charge, Ryan; * move to dynamic alloc_percpu as powerpc's PMD_ORDER is not const, kernel test robot; * make anon_fault_alloc and anon_fault_fallback more consistent with thp_fault_alloc and thp_fault_fallback, Ryan; * handle cpu hotplug properly, Ryan; * add docs for new sysfs nodes and ABI, Andrew. -v4: * Many thanks to David and Ryan for your patience and valuable insights throughout the numerous renaming efforts! * Guard the case order > PMD_ORDER in count func rather than in callers, Ryan; * Add swpout counters; * Add a helper DEFINE_MTHP_STAT_ATTR to avoid code duplication for various counters; link: https://lore.kernel.org/linux-mm/20240405102704.77559-1-21cnbao@gmail.com/ -v3: https://lore.kernel.org/linux-mm/20240403035502.71356-1-21cnbao@gmail.com/ Barry Song (2): mm: add per-order mTHP anon_alloc and anon_alloc_fallback counters mm: add per-order mTHP anon_swpout and anon_swpout_fallback counters mm: add docs for per-order mTHP counters and transhuge_page ABI mm: correct the docs for thp_fault_alloc and thp_fault_fallback .../sys-kernel-mm-transparent-hugepage | 17 +++++ Documentation/admin-guide/mm/transhuge.rst | 32 ++++++++- include/linux/huge_mm.h | 53 +++++++++++++++ mm/huge_memory.c | 65 +++++++++++++++++++ mm/memory.c | 3 + mm/page_alloc.c | 4 ++ mm/page_io.c | 1 + mm/vmscan.c | 3 + 8 files changed, 176 insertions(+), 2 deletions(-) create mode 100644 Documentation/ABI/testing/sys-kernel-mm-transparent-hugepage -- 2.34.1