From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f71.google.com (mail-pj1-f71.google.com [209.85.216.71]) (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 931933F1659 for ; Thu, 23 Jul 2026 07:50:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.71 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784793057; cv=none; b=N1EG0muTMwcRcricb3aJyu12J6YM0odACOnsASP0SoBe0jAXDhITtjcAGyxQVC1nIb2iWpqx8SIHAwQZ5eCQbb90ald6NZXI32ExnvbReMSznAQ34Ndz3hprvuvfP1ii0lWc7WIeLRlufRZuYngPW17D+pXnIZlbqF/8m+OFUIs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784793057; c=relaxed/simple; bh=6/GUZTnm7PcCEVB5fPYxBc6y6EYRp5VR2hoMPMCFWSE=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=EHT95na++esbUZMZefbbequFum6AaDf206gqB7MLBXAJ6EKTM/UnaGdDhWniZGemNFRIRajKKNdWKe7ZWZTApeAm3vypB6iO4nsDpCCor+pxLKAFqXp2nnpVidbfxMD/AVmHbeP/XKm/xIdWOuWL0MzlGhMAEuhtz1qShLPp0fA= 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=OijX/KLL; arc=none smtp.client-ip=209.85.216.71 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="OijX/KLL" Received: by mail-pj1-f71.google.com with SMTP id 98e67ed59e1d1-38e2f61c09dso759860a91.2 for ; Thu, 23 Jul 2026 00:50:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1784793056; x=1785397856; 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=FxjTJiqjVFLTCaDJDgC11KYRNKaCxojd2JWjTxQwclM=; b=OijX/KLLjrGAg6CVUbIv1DZnJRDYo/o9Q6gLO5bQgbaTvvmI8sH45kbRPJ5+IZ3yL+ ++J6sskE/i2NV09fKh6NAdeDAypxhMgOvrkVUUjoe94klJIwBPvlM2XTay9tPGcOknc8 p6upwSiWgvITSuz+Bik1XfISiuMOq+nZK4+sK+n8G/0Tv7WfvwPExJb8XnosbdAB1iT4 FAz9TCYYyZkBJ01W9nPlMx9zwxcmZnxU6waR3+v96uDmCgVbfQk/AhlkWR/7uFe7zsJx Zsv3yX4g05GUVhZVpy3WQihLTW/ZuO9db8gVYA4XG07VBMxQ8R79234EQJxN1uJHdCc2 4EYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784793056; x=1785397856; 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=FxjTJiqjVFLTCaDJDgC11KYRNKaCxojd2JWjTxQwclM=; b=TTbdHJSK+50lXcvUOQjEdzl0Tbq+jUwxTR9HexSwfs5yRseL5+qAtfKvcdirOfAgLX KMDwsNfuFbxK8hT4moMghbreDvMeRNLhIlxQ8nymAPTfswkCo3OYYdrcuQUojalw2LIe kS9EsIeLPaQRmoM8LPVCozq3S5jctp3pdgYP1sBIWhq5iFWvBwPtYbXJtgg0BJXU3Elw p4sBA5SNBTR7/IgeEarriPvTzyXli/5yBzHJsPe+fmR0WrnIOOInnxFttxi3AyEfVzwZ 33c+RI8E5a8Cy+K2r0Fi61TpCl3iMKKvyzGlkryxxs35NDSm3Nijy4NHB7YNxjg7LOfA 9RWg== X-Forwarded-Encrypted: i=1; AHgh+Rr7zpv7AgDByq5OQIA4lfLdRNGI8bt26fcJJRadhiGKpau9AoxS1HiLJFFwmG2fKpw9u7ABCIWjnyZxfhM=@vger.kernel.org X-Gm-Message-State: AOJu0YwqwwYMNkGX3ZDtA0zN0YDhjBctXsbMaXcyJczBLrX6Sew4hSLE EKLaMRNLrki8IH9g9pbYO/wZn4Q3b8vuDQiGp+A0x3MycronOBMpYbMFlrlrkmg0KvvjONXVNOO Gfg004665bg== X-Received: from dlep8-n2.prod.google.com ([2002:a05:701b:4588:20b0:13b:a040:bbf1]) (user=jyescas job=prod-delivery.src-stubby-dispatcher) by 2002:a17:90b:4a83:b0:38d:ec31:4840 with SMTP id 98e67ed59e1d1-38ec651c5bcmr2107431a91.13.1784793055781; Thu, 23 Jul 2026 00:50:55 -0700 (PDT) Date: Thu, 23 Jul 2026 00:47:17 -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-14-jyescas@google.com> Subject: [RFC PATCH 13/16] mm: Create the file asociated with an allocation 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 the file asociated with an allocation. The name of the file will be given by incrementing the atomic long "allocs_file_seq". This file will be used to free the alocation when the user requests it. Signed-off-by: Juan Yescas --- mm/page_alloc_hogger.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/mm/page_alloc_hogger.c b/mm/page_alloc_hogger.c index 7f6eebdd5197..203b71a25e64 100644 --- a/mm/page_alloc_hogger.c +++ b/mm/page_alloc_hogger.c @@ -186,12 +186,26 @@ inline void set_migrate_type_to_alloc_from(int migrate_type, gfp_t *flags_ptr) } } +static ssize_t page_alloc_read(struct file *file, char __user *ubuf, + size_t cnt, loff_t *ppos) +{ + /* Which information should be print about the page or allocation? */ + return 0; +} + +static const struct file_operations page_alloc_fops = { + .owner = THIS_MODULE, + .open = simple_open, + .read = page_alloc_read, +}; + static int make_alloc(struct req_alloc *req, gfp_t flags, unsigned long *alloc_id) { struct page_alloc *pa; struct page *page; char new_alloc_name[12]; + struct dentry *new_alloc_dentry; int ret; page = alloc_pages_node_noprof(req->node_idx, flags, req->order); @@ -210,14 +224,26 @@ static int make_alloc(struct req_alloc *req, snprintf(new_alloc_name, sizeof(new_alloc_name), "%lu", *alloc_id); + new_alloc_dentry = debugfs_create_file( + new_alloc_name, 0644, req->parentdir, + pa, &page_alloc_fops); + if (IS_ERR(new_alloc_dentry)) { + ret = PTR_ERR(new_alloc_dentry); + goto erase_xa_entry; + } + pa->req_alloc = req; pa->page = page; + pa->alloc_dentry = new_alloc_dentry; } else { return -ENOMEM; } return 0; +erase_xa_entry: + xa_erase(&allocs_xa, *alloc_id); + free_page_alloc: kmem_cache_free(page_alloc_cache, pa); -- 2.55.0.229.g6434b31f56-goog