From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 54947387352 for ; Fri, 20 Mar 2026 11:35:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774006528; cv=none; b=Dt+lOeTKnZn+Yg5NQzgU69uHicKL0MQJ/VDeZW01Lv3uu4J7ZjUjGE+DzIBEYVtwaexGrmrTpzABMsGkNUOy9DNiLpBaUw7B386fUj9d3olq/VdkFbWY43BsBHe7QiEOpefOopvYhwQbN0dMNr9pF8Q6jb1kZlpVVs9Nc0BACMc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774006528; c=relaxed/simple; bh=9pNvu6S6oDhM5h9WgjMrUwgzjvJ+ZdQO7AyPrErzbh8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=iHCzP6O7QXNHRKfceKXK3pngqVl6Jz11kIEe3HFCPnL2AhCLw4numPJIwgbpDGIcM+aX/ym81Clzp8pOuslB3+L8rhgLn1cZM6DCQ73oyaZe1K/Emh4AgTWDUc1lvpgqV3VIQBM/oH17t45qNOHzG6fNMqnOIAid04577vOhYok= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=t4ETvcgG; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="t4ETvcgG" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B1331C2BC9E; Fri, 20 Mar 2026 11:35:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774006528; bh=9pNvu6S6oDhM5h9WgjMrUwgzjvJ+ZdQO7AyPrErzbh8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=t4ETvcgG+DtBZacynsUwUuZzc9gslv6ATrxqYuzM5SYDxYfMTJwJDAsaphiO+bvvO OICL23t3UAxusfjHjVPExe4XEhAXpYpoOdlmD5QaRgAoXbGt/+EU1rx4kdZui/NOSJ oEGXus0qrZn9Mu47YVU9qp2UUNi3kVi2ss0cmW8LbGfxEz4wc4/HRpost/ZSflILHB rD3hTQAh7fiymU01Hv+QWJg80hKaQ4b2uEY3XwFrWPkHiOy5rBU3msgnspXcikMgT2 VMvXXysLtGhQ6LOTSijog2x7X8hA5lpL2caBJ588S+wvIMyL8V7pF3NM5Gfy6SCArG b5FdpcagKWM+A== Date: Fri, 20 Mar 2026 13:35:21 +0200 From: Mike Rapoport To: Pratyush Yadav Cc: Chenghao Duan , pasha.tatashin@soleen.com, akpm@linux-foundation.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, jianghaoran@kylinos.cn Subject: Re: [PATCH v1 3/3] mm/memfd_luo: use i_size_write() to set inode size during retrieve Message-ID: References: <20260319012845.29570-1-duanchenghao@kylinos.cn> <20260319012845.29570-4-duanchenghao@kylinos.cn> <2vxzqzpebzi2.fsf@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2vxzqzpebzi2.fsf@kernel.org> On Fri, Mar 20, 2026 at 09:51:01AM +0000, Pratyush Yadav wrote: > On Thu, Mar 19 2026, Chenghao Duan wrote: > > > Use i_size_write() instead of directly assigning to inode->i_size > > when restoring the memfd size in memfd_luo_retrieve(). > > The commit message can be improved. It only explains _what_ the patch > does. Readers can see that by looking at the code. So it just repeats > information that is already there. > > To be fair, for more complex patches explaining the what does make sense > since it might not always be obvious. But what is almost always be a lot > more useful is to explain _why_ this change is made. > > I intentionally assigned i_size directly here. The reason for that being > that no one has access to the inode yet so there is no need for the > smp_store_release() since there won't be racy accesses. So my first > reaction on reading this was to check if I missed some sort of race > condition. I don't see any, but this is exactly the kind of thing the > commit message should say. > > So please, explain why you made this change. The reason can be as simple > as "for consistency", but there should be one so reviewers aren't left > guessing. > > > > > No functional change intended. > > > > Signed-off-by: Chenghao Duan > > --- > > mm/memfd_luo.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/mm/memfd_luo.c b/mm/memfd_luo.c > > index 413df8c75c1d..5e5971f25c68 100644 > > --- a/mm/memfd_luo.c > > +++ b/mm/memfd_luo.c > > @@ -500,7 +500,7 @@ static int memfd_luo_retrieve(struct liveupdate_file_op_args *args) > > } > > > > vfs_setpos(file, ser->pos, MAX_LFS_FILESIZE); > > - file->f_inode->i_size = ser->size; > > + i_size_write(file_inode(file), ser->size); > > For the code change, I am neutral. I don't suppose it makes much of a > difference, but if people think this is cleaner fine by me. I'd also add a comment here explaining that i_size_write() is for consistency :) > > > > if (ser->nr_folios) { > > folios_ser = kho_restore_vmalloc(&ser->folios); > > -- > Regards, > Pratyush Yadav -- Sincerely yours, Mike.