From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-f199.google.com (mail-pg1-f199.google.com [209.85.215.199]) (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 DEC1F39D3D3 for ; Thu, 6 Aug 2026 01:10:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.199 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785978652; cv=none; b=qfziEVxt7z2eGwkVboDYjEy22pBBeh5WG42NZNqgG8TRar9rgto6Ts4DCMKAKtY2NW3wCTnUfOKYOd4+vdv5uRiFfokAYOWfv0qgMeDfuJUaSgHNITS68Ky5M/bgqXns3I1a/FLSXGOktBc7XpoPjEx4mu7LGySffazgmy+GRic= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785978652; c=relaxed/simple; bh=qI7NPrUx1/XIyEOhH/pntuYv4Etmph40IwPADuz2saw=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=YqTZbmK4WnWoaKruUV+BYIlpUMG2bDE7QndTE2VcwPIxh3kuWVbcl1BlXZ/ATMf6LOQjoFdk7574XIpPT0ZhH6/NJfiK0QYFAFRu1uT6WHfeStqKjG35z7teCmXpaVIyTS1lATILSpIWQV4hDQjfwWDeM519ZFjPpyJZ1bxL5vo= 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=FT1P8TNc; arc=none smtp.client-ip=209.85.215.199 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="FT1P8TNc" Received: by mail-pg1-f199.google.com with SMTP id 41be03b00d2f7-cbe77d6864dso1356727a12.2 for ; Wed, 05 Aug 2026 18:10:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1785978650; x=1786583450; 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=aS8xXOT3cwfqq2+uivefl5lw088kY5Aqo4LU/nVZhwc=; b=FT1P8TNcONM9ClSMyPOKyzFh8qF7piWFQW7rbFLoQE9KIXnGM7OZQLcGeJG2+9e1YX yxQx/q0lqbZR+KzLR3ITWwNdOCtFGCyomsURuO1uM0c5RDsE8lmtIegJ+WsRwF0mzT5p 1U8X+9A8ycwzAiuXrJifXgaPRERmX+nDXLOWbEnP6LblPk/7yuKXjyHkH/qXR8gmAWm8 s1hqpwPni3/t292/Pp2HURGORzBh/3RKrlvnQaAVbjhHEkv2LK8AEJnol037n6vVEIH+ e1XuGNT4F2Q8/2vdpScuRXH6zSyeyVgf1UsGQ57UcoO80ikEUgMYJHDWZAis8pmGGAdc QAdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785978650; x=1786583450; 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=aS8xXOT3cwfqq2+uivefl5lw088kY5Aqo4LU/nVZhwc=; b=HLhVKGgOJ2EGyKBAI2Tj7NTJ0FtXuHm8AGheuoBaBLEePuoJRv5zTx0UleUjrmgRd5 CJv/E/NEQl5PicJuFvfVsQZna0LmvwMG1C2VIpR0q9ieSvUoXiVfwF3Tu0BUSFvyvEFw uGpL4G5iiuia5LTj9uis/Sm4OTIJNLgU2g4uz8nSpMUILfgpv1dZ0Je1tQulE9ZuQMRY w2J9ZEeCkeMFUlE+9F9TfQCIoAIPoSILjx5CK1saWVlLL3BDQRqTIa0WbZjn1BLa3BLd DXcGs1WhZ6JHfA8L3rjndpHNxqpyz2jHsIeOrEGvcz1BN2fc1PegO9nPwUdX09CbmhkS /F2Q== X-Forwarded-Encrypted: i=1; AHgh+RoA8LvevApgFZ2zb1OlcQS5H2KqZyGy2hH6KdilKKt7tiKdMonIVSlA4f2se5YWWmxTTFiyjD2UpG0sf3I=@vger.kernel.org X-Gm-Message-State: AOJu0YzIncCf8RSLscxZUZmvdgKIuKz5NbimQQL4NjCqJTL10M7lOYZe T3Yha+H1ImpQw4b1KE/HZi08/Rmok+ks5CEiHwWf844hNxNDFitECosfh4OMGn2qYsFO8G+HR2P 8Ry0Q2E+dag== X-Received: from pgjx11.prod.google.com ([2002:a63:fe4b:0:b0:c9e:d5b:af1]) (user=jyescas job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a21:7483:b0:3c3:b57b:6285 with SMTP id adf61e73a8af0-3cb85dcc9b8mr13877577637.13.1785978650083; Wed, 05 Aug 2026 18:10:50 -0700 (PDT) Date: Wed, 5 Aug 2026 18:09:01 -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.629.g250fe7f194-goog Message-ID: <20260806011048.517229-1-jyescas@google.com> Subject: [RFC PATCH v2 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, ljs@kernel.org, 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 associated 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 | 610 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 623 insertions(+) create mode 100644 mm/page_alloc_hogger.c -- 2.55.0.629.g250fe7f194-goog