From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f70.google.com (mail-pj1-f70.google.com [209.85.216.70]) (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 78E023655CE for ; Thu, 23 Jul 2026 07:48:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.70 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784792938; cv=none; b=o7sGg8P99mo3Ixy+hCiEM86lpfOeMMEh5i2e7USKhBq8h5hHfx6apjnijeuvYzyTDXGQvMUaqqqoKmhX53OznyylB+QCDxDk1ABuOGyqDw7C8d8+jFT25JmwALtkN+FWcecBIYf+PUW7CnL5Z7izN7hCo/+O3njH1m1mfhiMNVs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784792938; c=relaxed/simple; bh=G/ddeHNyiviHCj39d5mvgUubCex6QznFjQGsz++YgXI=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=d5I1yPe3/iFzpkErPG60iYe0uJHdkhW7LplG9fCEOz7RvpjYFkYR+GqPU7QXmoOJd4B+B4ZcZhTCB/psfBRDq5M0fvnvdRHTOlDcNACg/elKCpBYK/IJz7UEhT9kPFs1DSRjgRnqbEciI/qY41LJLFvFTxLglvlgkAA62q37+Vs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--jyescas.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=YGL+GlXT; arc=none smtp.client-ip=209.85.216.70 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--jyescas.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="YGL+GlXT" Received: by mail-pj1-f70.google.com with SMTP id 98e67ed59e1d1-38e7ff7b375so589848a91.1 for ; Thu, 23 Jul 2026 00:48:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1784792937; x=1785397737; darn=vger.kernel.org; h=content-type:cc:to:from:subject:message-id:mime-version:date:from :to:cc:subject:date:message-id:reply-to:content-type; bh=gusZRfFfKa7qtypbT3scclATimT0ZS8Q0+Rj2BZOw1s=; b=YGL+GlXTDUvEz+6lkP7BVb5ClOzxujhTR8sZFMQYd8g01LwQ2/SuTwQfnrVHpuyXXl zgFIMmHs0fCdzTPKY4pIv2yP3UqBwzuNe07NYj75u6QdwFfxy/0J1sWlKki16RkkckDu Aczt68a/0Rj55Dd/u3c8PoGijKMe6JMg9Vow9/1dGJiOajpzCsTUc1B9Lu2Xf6t3xt6v 3R+fJQJRjC0tfzI/H24e2zHQDt5dmk6voZeCb59GGa4HVPgfc12G0fI5ZUi+idcO0FKQ sK4f6M7fm769okf4WDa/lgV1r2oE28ruiNmFDhxjyQaMXpjjmTgskFRT2A+nosZLXAaH SCnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784792937; x=1785397737; h=content-type:cc:to:from:subject:message-id:mime-version:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=gusZRfFfKa7qtypbT3scclATimT0ZS8Q0+Rj2BZOw1s=; b=VIa9Z6ltrO+loqVrH044IO6HrdA6PUJdqF4E84C8OUETj4vqVnHVSBcgEtmxyFfcTo yLd9UE184f+Z93CdvKwMuE9CDLgu8cmqgnztHC9OVI2CWsrPeEpsvXAaxT3Gnh7sZ07A 1FPLseRll2iUVGudrhuY/MGUEWhP1RAtwJ743w4bqxTzpM/k56VMsRmPdeWSOGvXD/E9 xPkjyrXyVUX6iStGQ4m6N9nd0YacWnOkhII+v2Yztu3CfqDkgkmQsupYuUgNIrnOJ3iQ nRlG3xHlEtlef9B9yZgLWSH9nWhC+T2U+Z9HF3kyZUGytqz0U4kZ8bD7hbgGXqL3iwPc aM3Q== X-Forwarded-Encrypted: i=1; AHgh+RqLz8sAboR3gHha7yvIsJJZ1He2Q4UM02b2SFHyjisv8l92e0p70QGd4Sw8DP9URV/79OXhq5E6sNR+ZaM=@vger.kernel.org X-Gm-Message-State: AOJu0Yy+QE2IVmUkfTi7EWj66wvhRJlQdHaBL5uyeWIUKptk38q7gG41 HyAs12DIkGrMZ+bYEqfT7wg0SQZMX5WUZArYc7H7vIuJ0bvLkroCReCWt9QhEoocP+sulYXLXmx dAdyry3gqdA== X-Received: from dlbsj2-n2.prod.google.com ([2002:a05:7022:f902:20b0:13d:210b:71ca]) (user=jyescas job=prod-delivery.src-stubby-dispatcher) by 2002:a17:90a:d887:b0:387:e0db:bc2b with SMTP id 98e67ed59e1d1-38ec661c2bemr1938697a91.43.1784792936485; Thu, 23 Jul 2026 00:48:56 -0700 (PDT) Date: Thu, 23 Jul 2026 00:47:04 -0700 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: git-send-email 2.55.0.229.g6434b31f56-goog Message-ID: <20260723074854.1013941-1-jyescas@google.com> Subject: [RFC PATCH 00/16] Page Alloc Hogger From: Juan Yescas To: Andrew Morton , David Hildenbrand , Lorenzo Stoakes , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , open list , "open list:MEMORY MANAGEMENT - CORE" Cc: jyescas@google.com, android-mm@google.com, fvdl@google.com, tkjos@google.com, minchan@google.com, dskiba@google.com, open list , "open list:MEMORY MANAGEMENT - CORE" Content-Type: text/plain; charset="UTF-8" This patch series introduces the Page Alloc Hogger. The Page Alloc Hogger allows you to allocate memory pages from specific nodes, zones, migration types, and orders directly via debugfs. This provides key benefits for testing and debugging: - Reproduce low-memory conditions: Easily trigger and inspect kernel mechanisms like direct reclaim, kswapd, the OOM killer, and allocation fallbacks. - Simplify memory pressure debugging: Debug issues that only manifest under memory stress without needing custom kernel drivers or userspace programs to allocate memory. - Simplify unit testing: Verify that memory management subsystems (direct reclaim, OOM killer, kswapd) trigger as expected in test suites. - Measure performance under stress: Evaluate how applications behave and perform during severe memory pressure. Usage: 1. To trigger the allocation, navigate to the debugfs path corresponding to your target node, memory zone, allocation order, and migration type, then write the requested allocation count to nr_pages_allocs. For example, to make 3 allocs of order 9, Migrate Type Movable, Zone Normal and Node 0, run: $ echo 3 > /sys/kernel/debug/mm/node-0/zone-Normal/order-9/migrate-Movable/nr_pages_allocs 2. For each allocation created, a corresponding file named sequentially (1, 2, n) will appear in that directory. $ ls /sys/kernel/debug/mm/node-0/zone-Normal/order-9/migrate-Movable/ 1 2 3 nr_pages_allocs 3. To free the allocation, write the allocation file name in /sys/kernel/debug/mm/free. For example, to release the 2nd allocation run: $ echo 2 > /sys/kernel/debug/mm/free Example: $ cat /proc/pagetypeinfo Page block order: 9 Pages per block: 512 Free pages count per migrate type at order 0 1 2 3 4 5 6 7 8 9 10 Node 0, zone DMA, type Unmovable 0 0 0 0 0 0 0 0 0 0 0 Node 0, zone DMA, type Movable 1 1 1 0 1 1 2 2 1 3 732 Node 0, zone DMA, type Reclaimable 0 0 0 0 0 0 0 0 0 0 0 Node 0, zone DMA, type HighAtomic 0 0 0 0 0 0 0 0 0 0 0 Node 0, zone DMA, type CMA 0 0 0 0 0 0 0 0 0 1 7 Node 0, zone DMA, type Isolate 0 0 0 0 0 0 0 0 0 0 0 Node 0, zone Normal, type Unmovable 13 7 0 1 0 0 1 0 1 0 0 Node 0, zone Normal, type Movable 1 1 1 1 1 1 1 0 1 1 1221 Node 0, zone Normal, type Reclaimable 1 0 0 0 0 0 1 0 0 1 0 Node 0, zone Normal, type HighAtomic 0 0 0 0 0 0 0 0 0 0 0 Node 0, zone Normal, type CMA 0 0 0 0 0 0 0 0 0 1 7 Node 0, zone Normal, type Isolate 0 0 0 0 0 0 0 0 0 0 0 Number of blocks type Unmovable Movable Reclaimable HighAtomic CMA Isolate Node 0, zone DMA 0 1520 0 0 16 0 Node 0, zone Normal 12 2530 2 0 16 0 $ echo 1200 > /sys/kernel/debug/mm/node-0/zone-Normal/order-10/migrate-Movable/nr_pages_allocs $ cat /proc/pagetypeinfo Page block order: 9 Pages per block: 512 Free pages count per migrate type at order 0 1 2 3 4 5 6 7 8 9 10 Node 0, zone DMA, type Unmovable 0 0 0 0 0 0 0 0 0 0 0 Node 0, zone DMA, type Movable 1 1 1 0 1 1 2 2 1 3 732 Node 0, zone DMA, type Reclaimable 0 0 0 0 0 0 0 0 0 0 0 Node 0, zone DMA, type HighAtomic 0 0 0 0 0 0 0 0 0 0 0 Node 0, zone DMA, type CMA 0 0 0 0 0 0 0 0 0 1 7 Node 0, zone DMA, type Isolate 0 0 0 0 0 0 0 0 0 0 0 Node 0, zone Normal, type Unmovable 13 7 1 1 0 0 0 0 1 0 0 Node 0, zone Normal, type Movable 1 1 1 1 1 1 1 0 1 1 21 Node 0, zone Normal, type Reclaimable 0 1 0 0 1 0 0 0 1 0 0 Node 0, zone Normal, type HighAtomic 0 0 0 0 0 0 0 0 0 0 0 Node 0, zone Normal, type CMA 0 0 0 0 0 0 0 0 0 1 7 Node 0, zone Normal, type Isolate 0 0 0 0 0 0 0 0 0 0 0 Number of blocks type Unmovable Movable Reclaimable HighAtomic CMA Isolate Node 0, zone DMA 0 1520 0 0 16 0 Node 0, zone Normal 12 2530 2 0 16 0 $ for i in `seq 1 1200`; do echo $i > /sys/kernel/debug/mm/free; done $ cat /proc/pagetypeinfo Page block order: 9 Pages per block: 512 Free pages count per migrate type at order 0 1 2 3 4 5 6 7 8 9 10 Node 0, zone DMA, type Unmovable 0 0 0 0 0 0 0 0 0 0 0 Node 0, zone DMA, type Movable 1 1 1 0 1 1 2 2 1 3 732 Node 0, zone DMA, type Reclaimable 0 0 0 0 0 0 0 0 0 0 0 Node 0, zone DMA, type HighAtomic 0 0 0 0 0 0 0 0 0 0 0 Node 0, zone DMA, type CMA 0 0 0 0 0 0 0 0 0 1 7 Node 0, zone DMA, type Isolate 0 0 0 0 0 0 0 0 0 0 0 Node 0, zone Normal, type Unmovable 13 7 1 1 0 0 0 0 1 0 0 Node 0, zone Normal, type Movable 1 1 1 1 1 1 1 0 1 1 1221 Node 0, zone Normal, type Reclaimable 0 1 0 0 1 0 0 0 1 0 0 Node 0, zone Normal, type HighAtomic 0 0 0 0 0 0 0 0 0 0 0 Node 0, zone Normal, type CMA 0 0 0 0 0 0 0 0 0 1 7 Node 0, zone Normal, type Isolate 0 0 0 0 0 0 0 0 0 0 0 Number of blocks type Unmovable Movable Reclaimable HighAtomic CMA Isolate Node 0, zone DMA 0 1520 0 0 16 0 Node 0, zone Normal 12 2530 2 0 16 0 Notes: - The only zone that is not supported is ZONE_DEVICE. - MIGRATE_CMA will be supported soon Juan Yescas (16): mm: Page Alloc Hogger module mm: Define structs for allocation requests and store allocations mm: Define the caches for the structs req_alloc and page_alloc mm: Define function to create a dir for each online node mm: Define function to create a dir for populated zone mm: Define function to create a dir for each page order mm: Define function to create a dir for each migrate type mm: Define function that creates the "nr_pages_allocs" file mm: Read the nr_pages_allocs value given by user mm: Set the selected zone in gfp_t flags mm: Sets the migrate type in gfp_t flags mm: Define the make_alloc() function mm: Create the file asociated with an allocation mm: Free pages, remove files and clean cache when one alloc fails mm: Create the "free" file to release the previously allocated pages mm: Release resources when the page alloc hogger module exits mm/Kconfig.debug | 12 + mm/Makefile | 1 + mm/page_alloc_hogger.c | 611 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 624 insertions(+) create mode 100644 mm/page_alloc_hogger.c -- 2.55.0.229.g6434b31f56-goog