From nobody Fri Apr 17 00:17:53 2026 Received: from mail-yx1-f42.google.com (mail-yx1-f42.google.com [74.125.224.42]) (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 B7519208D0 for ; Tue, 24 Feb 2026 20:31:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.224.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771965100; cv=none; b=j0O5of2vdGDpNvPWnY8ggo88yA18cNiBVSY9xwwB+eneC+UfzbGQXjp1mdURy2FaOOEnxrqr1EfiwDE938FdFEyuZ229ooQiWYFlMOxnOnrSItDG3t1fbzpb+DnHourDDDN0YgHB9WMCcnp6GpkaZFgDsEqRvAe0+lpEcRyc+GM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771965100; c=relaxed/simple; bh=s/BeKcdwUp6sSNpsC8vjE/rnKfbu2V42lD31IXmoHtQ=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=ZVTY4JgBxpbtLhGIE/gp8N5l3iFKucvFeXwJck3JyGh8vr6YNdPOlIAx1zvmbEJ9zfKRI+jC722c0IwyxMUbcahsXve0X9UWF/W9qNcCzddMtXVfZUWyOKakCUEpTsA+HTjM76b9Cfz2LLFiT+mfhI3mMQkjRzRRQLF9IkxQv5I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=GMRkNKD1; arc=none smtp.client-ip=74.125.224.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="GMRkNKD1" Received: by mail-yx1-f42.google.com with SMTP id 956f58d0204a3-64ad019bbd4so5602883d50.0 for ; Tue, 24 Feb 2026 12:31:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1771965099; x=1772569899; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=2N1kPWPrjzP43fjmchZyPdJ4RUupw1yJAlcJ3C95yhA=; b=GMRkNKD1Y4jEKp+qkjznzpDsbJ8G0GXV/G0Rb1UtvAxD3YszDRE5VxLS4n24ajtNG/ 6RwSbiyDL+pI5KtqU08de1tJFXzDie4QMnUP4O8kDu8mvFVl/ISPEucgwgDhaDrmJ05F FmS6m7kCua47nfRH1HIC6fQ5cv5K4dK6Fc11JSoLcuooMSi5QbO7TE/ABhtfkXxTr1PG zwZUl/FsJmtU/GcJPNh0aFQjH78xWFl28Hn1Y1mWGV64f/mbNgaFg9qTz3pAPOWMCq29 p1LuHRMLMVLE6E3vDVpuuN88nnKfuFh3sa0RsuCy6fFdPtAJoFc1ayfv+tr7ut1G2TVt dzmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771965099; x=1772569899; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=2N1kPWPrjzP43fjmchZyPdJ4RUupw1yJAlcJ3C95yhA=; b=nAjsADpp3HdXTxZ38duRzIUvzdh7E17yueDwVD+Fu6pgLvnG/OzugvJyisRIqM9d1z 36WCZyONR29og2MhQGNs7PEC1fJzTwJiM/Ttu0WVQSEPKqwlQe7P7+4XxB2FP+e6c04i vJepCZBo6Y6zobUOWVSpBpuK/jAGSvFI0RkVY6QCyBzU6wt3cDvZNHfFEdWRct425k4c jiWivzZdbuWtNWIGAAlkhTuBKEwwIBadt1peHs9pb+tEWL2rDDWWWYQ9k/Pa6+2UMYQJ ihSC76DuPxO10pADh+t9u90yPHc9PPoJZXp4WncuN9/0DzsHT5tb6wwbLWxn8TLDRVbx Jmsw== X-Forwarded-Encrypted: i=1; AJvYcCWIvmiqs9dSyEWNempaBL/1idhZpUA3LIyJwoOOTmGH0+if2ngM5+UT77qv3V5Vo1q9K2s1BvfDXCxUYhQ=@vger.kernel.org X-Gm-Message-State: AOJu0Yy1B1u//rQ/ycmBhTfXItk1pf7NycHj+P2/kYDbUtCqrWzSATkf 8QUc8Hjc7s9GcXpnxNTn2VBury4h/nudYLCoFoik1u3fsTln/0W7GsMahNLMyPi3 X-Gm-Gg: ATEYQzyFb0E35icP9EKRoccatqFD3ykAuMAu5yxExbr1Fjh6PWylzIvWN+k2H+qGSEQ Rqs5de7m5CZdo1AQi1nkEDlVNssWV4+bCsZ3CwpP1lQcjLs1ROXJUMjm4KZnrE627eebkZDFXY8 3WEU+vQTRYamcqGOeY6HfITWZTW3Q4qSCKf04P7/8ycAgkun7jpzlbAHcgO2VYOJJJycG25gyPj I08nl4Ecn7xt7YPk5lvxFXYmczthfcDMG+b1N5aImkcnOnGa4V2QHjBtCgXrBxG76F63yRz266P dQ78JlWriyktnI/EbfWTr+ZCt8rVFV6yLiBPyeHP+78tIWhe8EnZ9fzHieF071w4nVO0g4IfLJ7 DtWLCA46qVL59eyRTEgNFYukk7zU8yClPO0A5fyE6HwSRMX93fXyn2OmcZjIPIsK2gKboophUMP wj3u2laqa9iT9aAVGXxE3DkvE= X-Received: by 2002:a05:690c:e3e8:b0:798:270:fec0 with SMTP id 00721157ae682-79828cf8c2bmr114823047b3.5.1771965098356; Tue, 24 Feb 2026 12:31:38 -0800 (PST) Received: from ubuntu ([65.190.55.6]) by smtp.gmail.com with ESMTPSA id 00721157ae682-7982de13c91sm48025427b3.47.2026.02.24.12.31.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Feb 2026 12:31:37 -0800 (PST) From: AnishMulay To: Christian Brauner , Jan Kara Cc: Viacheslav Dubeyko , Damien Le Moal , Lorenzo Stoakes , linux-kernel@vger.kernel.org, AnishMulay Subject: [PATCH] ramfs: convert alloc_pages() to folio_alloc() in ramfs_nommu_expand_for_mapping() Date: Tue, 24 Feb 2026 15:31:34 -0500 Message-ID: <20260224203134.101436-1-anishm7030@gmail.com> X-Mailer: git-send-email 2.51.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Currently, ramfs_nommu_expand_for_mapping() utilizes the deprecated alloc_pages() API. This patch converts the allocation step to use the modern folio_alloc() API, removing a legacy caller and helping pave the way for the eventual removal of alloc_pages(). Because nommu architectures require physically contiguous memory that often needs to be trimmed to the exact requested size, the allocated folio is immediately shattered using split_page(). Since split_page() destroys the compound folio metadata, using folio iteration helpers (like folio_page) becomes unsafe. Therefore, this patch deliberately drops back to a standard struct page array after the split. This safely isolates the folio conversion to the allocation phase while strictly preserving the existing trimming and page cache insertion behavior. Signed-off-by: AnishMulay --- fs/ramfs/file-nommu.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/fs/ramfs/file-nommu.c b/fs/ramfs/file-nommu.c index 77b8ca2757e0d..767de8fc56f0f 100644 --- a/fs/ramfs/file-nommu.c +++ b/fs/ramfs/file-nommu.c @@ -62,6 +62,7 @@ const struct inode_operations ramfs_file_inode_operations= =3D { int ramfs_nommu_expand_for_mapping(struct inode *inode, size_t newsize) { unsigned long npages, xpages, loop; + struct folio *folio; struct page *pages; unsigned order; void *data; @@ -81,10 +82,12 @@ int ramfs_nommu_expand_for_mapping(struct inode *inode,= size_t newsize) =20 /* allocate enough contiguous pages to be able to satisfy the * request */ - pages =3D alloc_pages(gfp, order); - if (!pages) + folio =3D folio_alloc(gfp, order); + if (!folio) return -ENOMEM; =20 + pages =3D &folio->page; + /* split the high-order page into an array of single pages */ xpages =3D 1UL << order; npages =3D (newsize + PAGE_SIZE - 1) >> PAGE_SHIFT; --=20 2.51.0