All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 00/16] Page Alloc Hogger
@ 2026-07-23  7:47 Juan Yescas
  2026-07-23  7:47 ` [RFC PATCH 01/16] mm: Page Alloc Hogger module Juan Yescas
                   ` (16 more replies)
  0 siblings, 17 replies; 20+ messages in thread
From: Juan Yescas @ 2026-07-23  7:47 UTC (permalink / raw)
  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, android-mm, fvdl, tkjos, minchan, dskiba, open list,
	open list:MEMORY MANAGEMENT - CORE

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



^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2026-07-30  7:51 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-23  7:47 [RFC PATCH 00/16] Page Alloc Hogger Juan Yescas
2026-07-23  7:47 ` [RFC PATCH 01/16] mm: Page Alloc Hogger module Juan Yescas
2026-07-23  7:47 ` [RFC PATCH 02/16] mm: Define structs for allocation requests and store allocations Juan Yescas
2026-07-23  7:47 ` [RFC PATCH 03/16] mm: Define the caches for the structs req_alloc and page_alloc Juan Yescas
2026-07-23  7:47 ` [RFC PATCH 04/16] mm: Define function to create a dir for each online node Juan Yescas
2026-07-23  7:47 ` [RFC PATCH 05/16] mm: Define function to create a dir for populated zone Juan Yescas
2026-07-23  7:47 ` [RFC PATCH 06/16] mm: Define function to create a dir for each page order Juan Yescas
2026-07-23  7:47 ` [RFC PATCH 07/16] mm: Define function to create a dir for each migrate type Juan Yescas
2026-07-23  7:47 ` [RFC PATCH 08/16] mm: Define function that creates the "nr_pages_allocs" file Juan Yescas
2026-07-23  7:47 ` [RFC PATCH 09/16] mm: Read the nr_pages_allocs value given by user Juan Yescas
2026-07-23  7:47 ` [RFC PATCH 10/16] mm: Set the selected zone in gfp_t flags Juan Yescas
2026-07-23  7:47 ` [RFC PATCH 11/16] mm: Sets the migrate type " Juan Yescas
2026-07-23  7:47 ` [RFC PATCH 12/16] mm: Define the make_alloc() function Juan Yescas
2026-07-23  7:47 ` [RFC PATCH 13/16] mm: Create the file asociated with an allocation Juan Yescas
2026-07-23  7:47 ` [RFC PATCH 14/16] mm: Free pages, remove files and clean cache when one alloc fails Juan Yescas
2026-07-23  7:47 ` [RFC PATCH 15/16] mm: Create the "free" file to release the previously allocated pages Juan Yescas
2026-07-23  7:47 ` [RFC PATCH 16/16] mm: Release resources when the page alloc hogger module exits Juan Yescas
2026-07-28 19:29 ` [RFC PATCH 00/16] Page Alloc Hogger David Hildenbrand (Arm)
2026-07-29  0:36   ` Juan Yescas
2026-07-30  7:50     ` Lorenzo Stoakes (ARM)

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.