* [PATCH] mm/memfd_luo: use real folio index in retrieve error logs
@ 2026-08-06 10:05 Giorgi Tchankvetadze
2026-08-10 17:56 ` Pratyush Yadav
0 siblings, 1 reply; 2+ messages in thread
From: Giorgi Tchankvetadze @ 2026-08-06 10:05 UTC (permalink / raw)
To: Pasha Tatashin, Mike Rapoport, Pratyush Yadav, Andrew Morton,
open list:LIVE UPDATE, open list:LIVE UPDATE,
open list:MEMORY MANAGEMENT
Cc: Giorgi Tchankvetadze
From: Giorgi Tchankvetadze <giorgi@tchankvetadze.com>
memfd_luo_retrieve_folios() logs "folio index %ld" on its error paths
but passes the loop counter 'i' instead of the folio's actual index
held in the local 'index' variable (pfolio->index).
Pass 'index' to the three pr_err() calls so the logged index matches
the folio that actually failed. Since the saved index is a u64, use %llu with an
unsigned long long cast when printing it.
Fixes: b3749f174d68 ("mm: memfd_luo: allow preserving memfd")
Signed-off-by: Giorgi Tchankvetadze <giorgi@tchankvetadze.com>
---
mm/memfd_luo.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/mm/memfd_luo.c b/mm/memfd_luo.c
index 59de210bee5f..652dd21e6ef0 100644
--- a/mm/memfd_luo.c
+++ b/mm/memfd_luo.c
@@ -451,16 +451,16 @@ static int memfd_luo_retrieve_folios(struct file *file,
err = mem_cgroup_charge(folio, NULL, mapping_gfp_mask(mapping));
if (err) {
- pr_err("shmem: failed to charge folio index %ld: %d\n",
- i, err);
+ pr_err("shmem: failed to charge folio index %llu: %d\n",
+ (unsigned long long)index, err);
goto unlock_folio;
}
err = shmem_add_to_page_cache(folio, mapping, index, NULL,
mapping_gfp_mask(mapping));
if (err) {
- pr_err("shmem: failed to add to page cache folio index %ld: %d\n",
- i, err);
+ pr_err("shmem: failed to add to page cache folio index %llu: %d\n",
+ (unsigned long long)index, err);
goto unlock_folio;
}
@@ -472,8 +472,8 @@ static int memfd_luo_retrieve_folios(struct file *file,
npages = folio_nr_pages(folio);
err = shmem_inode_acct_blocks(inode, npages);
if (err) {
- pr_err("shmem: failed to account folio index %ld(%ld pages): %d\n",
- i, npages, err);
+ pr_err("shmem: failed to account folio index %llu(%ld pages): %d\n",
+ (unsigned long long)index, npages, err);
goto remove_from_cache;
}
--
2.52.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] mm/memfd_luo: use real folio index in retrieve error logs
2026-08-06 10:05 [PATCH] mm/memfd_luo: use real folio index in retrieve error logs Giorgi Tchankvetadze
@ 2026-08-10 17:56 ` Pratyush Yadav
0 siblings, 0 replies; 2+ messages in thread
From: Pratyush Yadav @ 2026-08-10 17:56 UTC (permalink / raw)
To: Giorgi Tchankvetadze
Cc: Pasha Tatashin, Mike Rapoport, Pratyush Yadav, Andrew Morton,
open list:LIVE UPDATE, open list:LIVE UPDATE,
open list:MEMORY MANAGEMENT, Giorgi Tchankvetadze
On Thu, Aug 06 2026, Giorgi Tchankvetadze wrote:
> From: Giorgi Tchankvetadze <giorgi@tchankvetadze.com>
>
> memfd_luo_retrieve_folios() logs "folio index %ld" on its error paths
> but passes the loop counter 'i' instead of the folio's actual index
> held in the local 'index' variable (pfolio->index).
>
> Pass 'index' to the three pr_err() calls so the logged index matches
> the folio that actually failed. Since the saved index is a u64, use %llu with an
> unsigned long long cast when printing it.
>
> Fixes: b3749f174d68 ("mm: memfd_luo: allow preserving memfd")
> Signed-off-by: Giorgi Tchankvetadze <giorgi@tchankvetadze.com>
> ---
> mm/memfd_luo.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/mm/memfd_luo.c b/mm/memfd_luo.c
> index 59de210bee5f..652dd21e6ef0 100644
> --- a/mm/memfd_luo.c
> +++ b/mm/memfd_luo.c
> @@ -451,16 +451,16 @@ static int memfd_luo_retrieve_folios(struct file *file,
>
> err = mem_cgroup_charge(folio, NULL, mapping_gfp_mask(mapping));
> if (err) {
> - pr_err("shmem: failed to charge folio index %ld: %d\n",
> - i, err);
> + pr_err("shmem: failed to charge folio index %llu: %d\n",
> + (unsigned long long)index, err);
Why the cast here? u64 is always printed by %llu. See
Documentation/core-api/printk-formats.rst.
> goto unlock_folio;
> }
>
> err = shmem_add_to_page_cache(folio, mapping, index, NULL,
> mapping_gfp_mask(mapping));
> if (err) {
> - pr_err("shmem: failed to add to page cache folio index %ld: %d\n",
> - i, err);
> + pr_err("shmem: failed to add to page cache folio index %llu: %d\n",
> + (unsigned long long)index, err);
> goto unlock_folio;
> }
>
> @@ -472,8 +472,8 @@ static int memfd_luo_retrieve_folios(struct file *file,
> npages = folio_nr_pages(folio);
> err = shmem_inode_acct_blocks(inode, npages);
> if (err) {
> - pr_err("shmem: failed to account folio index %ld(%ld pages): %d\n",
> - i, npages, err);
> + pr_err("shmem: failed to account folio index %llu(%ld pages): %d\n",
> + (unsigned long long)index, npages, err);
> goto remove_from_cache;
> }
--
Regards,
Pratyush Yadav
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-08-10 17:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-06 10:05 [PATCH] mm/memfd_luo: use real folio index in retrieve error logs Giorgi Tchankvetadze
2026-08-10 17:56 ` Pratyush Yadav
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox