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 81F9C3E8C4F; Fri, 6 Mar 2026 15:44:11 +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=1772811851; cv=none; b=DC4wGs1es0SYEnooo2CNcbzIDjafQsPonG2SsbbvPqEO7pEbveyYzU6o0qfk8got0CSiRFvvw9lH9t7K46TwspfPmwz2ni4h4sSeQiDdv+Q8QmfR81R2w2tH5ORqys9UNfSWcTnSPs7hNj4g8kVd72JH5oXAfiWnIB4s8O/XARA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772811851; c=relaxed/simple; bh=Wk4h9dnWkeV9U+ZTFSAgXgbx28Yra+Fa6gacJCp9eGo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Fxr95KYOWoDG3bpp63aDDGD9cj6LifPT9YKY8XK54nKXuEQGui/WUUEYZOLcZUO5LRtVu69bKl7AnZQnZNyXUbX67GY4T9m6sMQyLQoFimWNVuIXd/K0Rny/phm/g9a+1DJu1RA/Hitx1BI9KvPb0QUOYjtNCbeSpbTXEajGrUE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Sin/qmdA; 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="Sin/qmdA" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E0CE2C4CEF7; Fri, 6 Mar 2026 15:44:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772811851; bh=Wk4h9dnWkeV9U+ZTFSAgXgbx28Yra+Fa6gacJCp9eGo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Sin/qmdAh+e/cLQeAo844HNn73cnfzU0zCaK+3+yI6EQKZy9MgUHlMZfTkACMkyKc nGe+r3tk5rmd59+6VDMakoi4yvDy+lCSprKwKB40jG2KH9tw6FMzpGj8zK8RMSd6tl ucJ6SJywQ+x84Ds8R2AISvdvGCQ1omneuwqbqMFmEX9c+tygyAi+oSLR7Ceh8EoZdY RwXUqrzDidOWGTZvYHsTOClFSvEUF3qEY7oJX4970UNlbPwlbl6cC/MK2XbXWitZmS MZ+H7nmL51/ciAm6uORvQI3b6uzzQpDRPVn+eDRn1Q4SGg0TfFOSFYgy3zhSDsU/bi xcV5fhyeMurXQ== Date: Fri, 6 Mar 2026 17:44:04 +0200 From: Mike Rapoport To: Pratyush Yadav Cc: Pasha Tatashin , Andrew Morton , linux-kernel@vger.kernel.org, linux-mm@kvack.org, stable@vger.kernel.org Subject: Re: [PATCH 1/2] mm: memfd_luo: always make all folios uptodate Message-ID: References: <20260223173931.2221759-1-pratyush@kernel.org> <20260223173931.2221759-2-pratyush@kernel.org> <2vxzqzpybqyd.fsf@kernel.org> Precedence: bulk X-Mailing-List: stable@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: <2vxzqzpybqyd.fsf@kernel.org> On Thu, Mar 05, 2026 at 09:50:18AM +0100, Pratyush Yadav wrote: > On Wed, Feb 25 2026, Mike Rapoport wrote: > > > On Mon, Feb 23, 2026 at 06:39:28PM +0100, Pratyush Yadav wrote: > [...] > >> + > >> + /* > >> + * If the folio is not uptodate, it was fallocated but never > >> + * used. Saving this flag at prepare() doesn't work since it > >> + * might change later when someone uses the folio. > >> + * > >> + * Since we have taken the performance penalty of allocating, > >> + * zeroing, and pinning all the folios in the holes, take a bit > >> + * more and zero all non-uptodate folios too. > >> + * > >> + * NOTE: For someone looking to improve preserve performance, > >> + * this is a good place to look. > > > > I'd add a larger comment above memfd_luo_preserve_folios() that says that > > it allocates, pins etc and fold the last two paragraphs of this comment > > there. > > How about this: > > /* > * If the folio is not uptodate, it was fallocated but never > * used. Saving this flag at prepare() doesn't work since it > * might change later when the folio is used. Make it uptodate > * now to avoid this problem. > */ > if (!folio_test_uptodate(folio)) { > > And the comment above memfd_pin_folios() gets this: > > * NOTE: For someone looking to improve preserve performance, this is a > * good place to look. Also look at the folio zeroing below. Looks great to me > [...] > > -- > Regards, > Pratyush Yadav -- Sincerely yours, Mike.