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 5B1303EE1E5 for ; Thu, 23 Jul 2026 07:49: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=1784792991; cv=none; b=Gz9HztNQmd+OmTa6XWX0V8fyZ0NORdL/FjE5jw3z+5DMp0XZUT9YvydhbGYbuJODc7ZjczqbA3yDroms6j92JAnLb8AcZ+cFbPUdAb86BT6nuAwIGWU9X7742MfDOmW97tVW6COlXi9I3avZiBS4+OgOwPffOSbhLmbNCrALPbA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784792991; c=relaxed/simple; bh=gPr0cn0JTw05EmZKfqSaDPNjM6FuDTaUXAFggcBHKNo=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=rFLPcG41mADv7R3BMNo966iVsiJfXcPLEkZi6DEfSwwEEeJOYWYz3T99JP6SqCHi/dfm3iY3jsSbVN0ZPUpYVfSAwCg8sboHzNQwn/GICddmOpaW24mO6tqOQhnt3DZeYLcgwb9+JYDSVbgh5uxBtL0JnzE093VfPErMji6qm28= 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=c8dKHA84; 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="c8dKHA84" Received: by mail-pg1-f199.google.com with SMTP id 41be03b00d2f7-cb733fc5024so777887a12.2 for ; Thu, 23 Jul 2026 00:49:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1784792990; x=1785397790; darn=vger.kernel.org; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:from:to:cc:subject:date:message-id:reply-to :content-type; bh=loRVgN9ulm8PnZhPf0JyRbFqzx4gb/PePxillDVmero=; b=c8dKHA846y4AwPZ9ZvVK32tmVP97BHkAf8fYUUcnbHNTpx0m6FJmDA1m/qrTXfzh4t /EeB1a22Xg2/ivhNZV9DkuiNwbK6fb4A/cK3PrLmrLqRwWFrBA2D8yyNwyQt7URLpZRE 7lg5iKUzqZzE8QlcM1VcF5OktiOq81hZ5btr+MLX6xCwSAgxCHLARkwR8heMJnJOo1eG /lUsPmCI5Ot2nN2A5JRB6L9lOYw1k1qYVRcw10hi6oBjZH+gPRUoNtgLsvvAVik7tRRI 1PJ9nwKAoGZyL/gfI63NveOF+uLIdalyRgWhkBOzkGPVUDSsVARC7/ReFws9xG409TFt Uzaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784792990; x=1785397790; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=loRVgN9ulm8PnZhPf0JyRbFqzx4gb/PePxillDVmero=; b=FOMiytmg1HbQuCZkiJynTsRcMuxL+Pf4wZdA5MvXw/9Ho0gdshG3McKISrxgLRvyIx Ry2zZOgSClClyz2KW0GXld/KUuDBbRDYZ4FFIkJ81GprbQhmHh/q+wKOV/GnfjlfbbZ+ akAdy1mXchFV/e3wLJPb27N5uopoyxEDPXBOjxeXdjiVGfe6ih6x5OD7Psr2TwHttw2k HZQGQoI60Cfry0R8EPu3ZXEPPMW7ZJc5LyPOQoFMvjRUKbPdtGHXUbhHG205wb8ur0q+ fBxmDOrX4KxWODRXbWuveFEIzqzYyuvycSaQ58WE8DiE5001/5bvhir+OyPpEXPS78WO lvuw== X-Forwarded-Encrypted: i=1; AHgh+RreV/z+u+Yz4WnGUxVzTJ9LeVhR0drjWEIIpfqQmRHCMKGkwcQqlPkLXW4B4KUPVJiHaPc5CkOZIrZoso4=@vger.kernel.org X-Gm-Message-State: AOJu0YxFZUpvp6RxxjhiVptK3FTjOFuNnzVx7S27kWZHXO+0dBqvyMwi coysUBHvMZstUZ4tDYBUZ+888+0bAskotucoucD93zwKgWv4LHAum8aV1p/rh4MjF+AjerW58k6 AgwEC3BT8gA== X-Received: from dled5-n2.prod.google.com ([2002:a05:701b:42c5:20b0:139:fea6:ad4]) (user=jyescas job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a21:3994:b0:3c3:bd32:4587 with SMTP id adf61e73a8af0-3c44b1c86bcmr2158597637.44.1784792989393; Thu, 23 Jul 2026 00:49:49 -0700 (PDT) Date: Thu, 23 Jul 2026 00:47:08 -0700 In-Reply-To: <20260723074854.1013941-1-jyescas@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260723074854.1013941-1-jyescas@google.com> X-Mailer: git-send-email 2.55.0.229.g6434b31f56-goog Message-ID: <20260723074854.1013941-5-jyescas@google.com> Subject: [RFC PATCH 04/16] mm: Define function to create a dir for each online node 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 change creates a directory for each online node in the system. Signed-off-by: Juan Yescas --- mm/page_alloc_hogger.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/mm/page_alloc_hogger.c b/mm/page_alloc_hogger.c index 52ccc6e99eb5..880de1a6e9ea 100644 --- a/mm/page_alloc_hogger.c +++ b/mm/page_alloc_hogger.c @@ -89,6 +89,7 @@ #include #include #include +#include #include #include @@ -125,6 +126,27 @@ struct page_alloc { struct kmem_cache *req_alloc_cache; struct kmem_cache *page_alloc_cache; +/** + * create_nodes_subdirs() - Creates a directory for each online node in the + * system. Once that the node directory is created, it creates a directory for + * each zone in the node. + */ +static inline int create_nodes_subdirs(struct dentry *mmdir) +{ + struct dentry *nodedir; + int node_idx; + char dirname[12]; + + for_each_online_node(node_idx) { + snprintf(dirname, sizeof(dirname), "node-%d", node_idx); + nodedir = debugfs_create_dir(dirname, mmdir); + if (IS_ERR(nodedir)) + return PTR_ERR(nodedir); + } + + return 0; +} + static int __init page_alloc_hogger_debugfs_init(void) { int ret; @@ -154,8 +176,14 @@ static int __init page_alloc_hogger_debugfs_init(void) goto clean_page_alloc_cache; } + ret = create_nodes_subdirs(mmdir); + if (ret) + goto clean_dir; + return 0; +clean_dir: + debugfs_remove_recursive(mmdir); clean_page_alloc_cache: kmem_cache_destroy(page_alloc_cache); @@ -166,6 +194,7 @@ static int __init page_alloc_hogger_debugfs_init(void) error_exit: return ret; } + static void __exit page_alloc_hogger_debugfs_exit(void) { debugfs_remove_recursive(mmdir); -- 2.55.0.229.g6434b31f56-goog