From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AADFA2417D9 for ; Mon, 10 Aug 2026 17:56:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786384608; cv=none; b=t+nzbHqOeEw07Ys8Fmx9ZpzEm4T06TRY7IEDOXEZySk+b3CJ+jp2JIMW/ufLIVicn0OnRFPdyaLbBh2n+ARO9pGoA0+C2kY8gScNTl9B2C449t5zUK/CYRZmHgaWXZwO9DlIjs3ibEStjLR+H+rm82A+GEp7EiEW4ZWv6wf6pAk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786384608; c=relaxed/simple; bh=ItuVt1fhM2H3sFSjDV+h9lW6gjcsVnpbpoh2/80Vmus=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=Vyl+GXcsBxkHSymGw2CPYckfuSiwroy6juQta0L10AXJZiITQEQUQBEZcXX6oCtPG/x32DlgJjDqixn+GadbcUVq7+i9KAtTN84n8BSK+5bUbfpmD89R+F/NInAiX51ApExydCIVDgyLzjtbiJmsp41uMN0jeOGGNY73JGDoBLc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=GfNCPqjI; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="GfNCPqjI" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C35041F000E9; Mon, 10 Aug 2026 17:56:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1786384606; bh=4yvXfUeulRUEmTF42XYsxj9IZ6IxSMv/Y/T9OemFD68=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=GfNCPqjIISgcgG/+twUpZHtMXxXS7jfzB7cxJs3nCp4ahhZswUZSnbJYaWecCiRWf ff93HKBcIFo+iTMiUzBEUUAYwdTtuqlFYyKE8t1ifUbythVHJYTrVDD1G0/Hoo35U9 yXC3QwRUW7L4YIiIPKdqm+/GuUdjLwR/dSus1oEGbZj6O8pnezJpDdLwwoh7J36Bkf 1tajT0z240gUe9ZS5EjmxjOOLFyroqlsI4kJLpfnjAQX0K9JRKrTHmXwTXypL7ZoZ7 nmAy9+KMxo6xBaG+0zqEGOdzcfaS7AzyW2Sl1LEqEpV5cvEN8CaF1wCUVIVqL6qzQx qB6YbUzxFHSLg== From: Pratyush Yadav To: Giorgi Tchankvetadze Cc: Pasha Tatashin , Mike Rapoport , Pratyush Yadav , Andrew Morton , 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 Subject: Re: [PATCH] mm/memfd_luo: use real folio index in retrieve error logs In-Reply-To: <20260806100543.138902-3-giorgitchankvetadze1997@gmail.com> (Giorgi Tchankvetadze's message of "Thu, 6 Aug 2026 14:05:39 +0400") References: <20260806100543.138902-3-giorgitchankvetadze1997@gmail.com> Date: Mon, 10 Aug 2026 19:56:43 +0200 Message-ID: <2vxz5x1h6eqs.fsf@kernel.org> User-Agent: Gnus/5.13 (Gnus v5.13) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain On Thu, Aug 06 2026, Giorgi Tchankvetadze wrote: > From: Giorgi Tchankvetadze > > 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 > --- > 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