From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f69.google.com (mail-pj1-f69.google.com [209.85.216.69]) (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 D53023EEAE1 for ; Thu, 23 Jul 2026 07:49:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.69 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784792984; cv=none; b=k2AETcRlp5IGpH6xXDISK4w7JPnc14KSH0Z9yk3hkvW7DqJKWFDGP1XYQongOUVGPEVNYVnqs/JFb0LxnLtu1KvRNxyyI4vBKeaZSwuWfpZsiCz512zMNAi2wppcKsoW9gkLvny0JGN9vegWWkrpSDdCabHYTcyxd7oio9r93PI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784792984; c=relaxed/simple; bh=JsDP+IMAdM/jN3KkQ0s3W7AM3KklJ4G09cqWVsyNfVk=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=KRr75mCP8kuWM/LXSRww8WgWjXe0u6AELajJej+0bmQvDnv8NwL5dHTn0x6GjiZjTivv5dwuEi8MceSY7P+pX396V3WCyXqcwQXq1MSbg5hrPIfLKrFv6NCOHNZQ14bCi0Ta44dI0uEQNACzY8HlXtSwIr4p5mSlfIbjzMG2S6M= 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=fPCKf02X; arc=none smtp.client-ip=209.85.216.69 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="fPCKf02X" Received: by mail-pj1-f69.google.com with SMTP id 98e67ed59e1d1-381250979d5so470132a91.0 for ; Thu, 23 Jul 2026 00:49:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1784792982; x=1785397782; 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=CxFUoK0o7AOxXwUayK1WHtnxjmfT1NGEks3Fz4KRfjY=; b=fPCKf02Xd7wQSwUINlTKp7ditUkHom9PDbRuJp/aEbVD8ULygXS5DvVHbVznOUj/L+ SigCgJtPQnGnfSA5IYJa1uYNXT/v7SW8qiF6dW5s9theavyoZUPmGaU/qRy586BoITh5 tGgtoiw9/pyKpVEoT7HV11ckk/fwty7zftWZOhkVDbi74L/lPE4kmWa7QAq9mQS+/4ax gnTMS4idI+cqUXzxshpmxLI6UY+axtnX9wP6ScZ66L88J9BBAktRHJnfeneh2Ph4wJf8 0YtDS2DCgJJUEYGcNXl0O3uW/wAyPoA6Q4BPsmh6c8mIpHR6XyyWm9Fb20X3bmJALZpI zQNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784792982; x=1785397782; 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=CxFUoK0o7AOxXwUayK1WHtnxjmfT1NGEks3Fz4KRfjY=; b=G9ZHNG11eocXhwL6hbt45vOTOVaUQ1XhQm3U4Eap+kigm9Hg220bn1dVtbM0Up9lGS Hb1MDo+gNtvLAO6d2xYyu0j63AE6tP8XbuyQArAVVX5C+EHRdO0P6kRZRAjCmw1Ml+ee FAUaMyRqX+1uQAhuftTvOyzpcVT+ueLfhxorXoD3bz1jPBkUB8KRH+NDJIJMe/hfyAWp ngjjAR9WJgCB7e0ajwoWwJkEi/E+cIL8CVmMHwEZvB9cLQPFEm1KO6E6/lH/XlRzMtWr DkHM52Y3JRuyGlGaoYMywQKaraJNJBdCLW17PZFhheIAlzjqdNZ+lCF+ojJCnQxisKje ajSw== X-Forwarded-Encrypted: i=1; AHgh+Rp43LGW6qaZPrpWwCm2BK8iSLaehXqUy9lHkec5WsyNA05Iu/vDvG0POefwinfqefofR/wBdDwxmLIe5vQ=@vger.kernel.org X-Gm-Message-State: AOJu0YxNkUZnOFEj9TdyDAjxWvut/xjTGR346ctdjox4TrD2e1FvB8En h6yZb2YDf9XJ15ZeXugz/Nm1eESNpY6UXwZXt/mODKiJEipa9UfywRtmgXaMFGZVJsbl3V1O3gu 5MKcXMHUgog== X-Received: from dldyr4-n2.prod.google.com ([2002:a05:701b:4504:20b0:13b:882c:fd28]) (user=jyescas job=prod-delivery.src-stubby-dispatcher) by 2002:a17:90b:4c12:b0:387:e0db:bc34 with SMTP id 98e67ed59e1d1-38ec688a747mr1713501a91.42.1784792981876; Thu, 23 Jul 2026 00:49:41 -0700 (PDT) Date: Thu, 23 Jul 2026 00:47:07 -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-4-jyescas@google.com> Subject: [RFC PATCH 03/16] mm: Define the caches for the structs req_alloc and page_alloc 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 defines and initializes the caches for the structs req_alloc and page_alloc. Signed-off-by: Juan Yescas --- mm/page_alloc_hogger.c | 42 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/mm/page_alloc_hogger.c b/mm/page_alloc_hogger.c index 47b08d056978..52ccc6e99eb5 100644 --- a/mm/page_alloc_hogger.c +++ b/mm/page_alloc_hogger.c @@ -85,9 +85,12 @@ #include #include +#include +#include #include #include #include +#include struct dentry *mmdir; @@ -119,20 +122,55 @@ struct page_alloc { struct dentry *alloc_dentry; }; +struct kmem_cache *req_alloc_cache; +struct kmem_cache *page_alloc_cache; + static int __init page_alloc_hogger_debugfs_init(void) { + int ret; + + req_alloc_cache = kmem_cache_create( + "req_alloc_cache", sizeof(struct req_alloc), 0, + SLAB_HWCACHE_ALIGN, NULL); + if (!req_alloc_cache) { + pr_err("The req_alloc_cache couldn't be created"); + ret = -ENOMEM; + goto error_exit; + } + + page_alloc_cache = kmem_cache_create( + "page_alloc_cache", sizeof(struct page_alloc), 0, + SLAB_HWCACHE_ALIGN, NULL); + if (!page_alloc_cache) { + pr_err("The page_alloc_cache couldn't be created"); + ret = -ENOMEM; + goto clean_req_alloc_cache; + } + mmdir = debugfs_create_dir("mm", NULL); if (IS_ERR(mmdir)) { pr_err("Unable to create mm directory"); - return PTR_ERR(mmdir); + ret = PTR_ERR(mmdir); + goto clean_page_alloc_cache; } return 0; -} + +clean_page_alloc_cache: + kmem_cache_destroy(page_alloc_cache); + +clean_req_alloc_cache: + kmem_cache_destroy(req_alloc_cache); + +error_exit: + return ret; +} static void __exit page_alloc_hogger_debugfs_exit(void) { debugfs_remove_recursive(mmdir); + kmem_cache_destroy(req_alloc_cache); + kmem_cache_destroy(page_alloc_cache); } module_init(page_alloc_hogger_debugfs_init); -- 2.55.0.229.g6434b31f56-goog