All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pratyush Yadav <pratyush@kernel.org>
To: Giorgi Tchankvetadze <giorgitchankvetadze1997@gmail.com>
Cc: Pasha Tatashin <pasha.tatashin@soleen.com>,
	 Mike Rapoport <rppt@kernel.org>,
	 Pratyush Yadav <pratyush@kernel.org>,
	 Andrew Morton <akpm@linux-foundation.org>,
	 kexec@lists.infradead.org (open list:LIVE UPDATE),
	 linux-kernel@vger.kernel.org (open list:LIVE UPDATE),
	linux-mm@kvack.org (open list:MEMORY MANAGEMENT),
	 Giorgi Tchankvetadze <giorgi@tchankvetadze.com>
Subject: Re: [PATCH] mm/memfd_luo: use real folio index in retrieve error logs
Date: Mon, 10 Aug 2026 19:56:43 +0200	[thread overview]
Message-ID: <2vxz5x1h6eqs.fsf@kernel.org> (raw)
In-Reply-To: <20260806100543.138902-3-giorgitchankvetadze1997@gmail.com> (Giorgi Tchankvetadze's message of "Thu, 6 Aug 2026 14:05:39 +0400")

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


  reply	other threads:[~2026-08-10 17:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]
2026-08-11  5:59   ` Giorgi Tchankvetadze

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2vxz5x1h6eqs.fsf@kernel.org \
    --to=pratyush@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=giorgi@tchankvetadze.com \
    --cc=giorgitchankvetadze1997@gmail.com \
    --cc=kexec@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=pasha.tatashin@soleen.com \
    --cc=rppt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.