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 5AE121369B4 for ; Mon, 1 Dec 2025 06:54:44 +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=1764572084; cv=none; b=PH8q90yp2vdbJ0nShdDswMCAG9Hh9T++IMykmEowLtnWYDPs5Op9e5DX/KH7h3H88PdlpXtwhF2vKaY35kcnjq6h24xxIQatcJXN4VqhmPjm+xC6K77RlgwQQn82b1yAlaEStCIruKifKon5UEMfygIgu8r5zGM/t1ozKiwNfaU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764572084; c=relaxed/simple; bh=GZa2G5potCEIy2zDYWbNMaWHtJEpt1+etp9afgwxZe4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=bBOcmO9LGON1XpKPRPGG9eN3QH0IctZAID5K8ySgm4amfmYG8WYHsDP78xL7FkDSx0ZWkLhRjqCkpejHqU3mKXckPYJck+UP0hRacYAG3B6Oiyot9WvqfIk+ZYqhkTQZynydi8dWvCKMRMGuurrIrpytgvVZUSN6DRSHdM15Uic= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=WdAKNk1h; 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="WdAKNk1h" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6EAD2C4CEF1; Mon, 1 Dec 2025 06:54:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1764572083; bh=GZa2G5potCEIy2zDYWbNMaWHtJEpt1+etp9afgwxZe4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=WdAKNk1hWm3DX8qCSqa7BmET/VUYWlGAiMYdrMjsuaX41rYPyBHVMB+q12pm22Vrv rBqn9IWfSxYleSP6P4jyohMRicda6JSV2BzlKydRxOh2xWNEVtFbxmPDlSVisR316X q7x4fgGqRjOPywcvXoPk+yXbBb9pxIPyEPJ2lChanfBYSjqzo55+npSk53iJZOXWuJ x5NVxFEMeCE6kkUHB1rwzRx88EOl5OJuOth3QofJnhftx81+He3b3ZKev+26Kkj7ll ewUlqp6vlnDeSar9607LapxHYwgAVguPFqBDrkcfVxONYTkGHcKzzgTUr8Vpn7fblO Z7gUz3+bu5Q8g== Date: Mon, 1 Dec 2025 08:54:37 +0200 From: Mike Rapoport To: Pratyush Yadav Cc: Andrew Morton , Alexander Graf , Pasha Tatashin , kexec@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] kho: fix restoring of contiguous ranges of order-0 pages Message-ID: References: <20251125110917.843744-1-rppt@kernel.org> <20251125110917.843744-3-rppt@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: Hi Pratyush, On Tue, Nov 25, 2025 at 02:45:59PM +0100, Pratyush Yadav wrote: > On Tue, Nov 25 2025, Mike Rapoport wrote: ... > > @@ -243,11 +243,16 @@ static struct page *kho_restore_page(phys_addr_t phys) > > /* Head page gets refcount of 1. */ > > set_page_count(page, 1); > > > > - /* For higher order folios, tail pages get a page count of zero. */ > > + /* > > + * For higher order folios, tail pages get a page count of zero. > > + * For physically contiguous order-0 pages every pages gets a page > > + * count of 1 > > + */ > > + ref_cnt = is_folio ? 0 : 1; > > for (unsigned int i = 1; i < nr_pages; i++) > > - set_page_count(page + i, 0); > > + set_page_count(page + i, ref_cnt); > > > > - if (info.order > 0) > > + if (is_folio && info.order) > > This is getting a bit difficult to parse. Let's separate out folio and > page initialization to separate helpers: Sorry, I've missed this earlier and now the patches are in akpm's -stable branch. Let's postpone these changes for the next cycle, maybe along with support for deferred initialization of struct page. > /* Initalize 0-order KHO pages */ > static void kho_init_page(struct page *page, unsigned int nr_pages) > { > for (unsigned int i = 0; i < nr_pages; i++) > set_page_count(page + i, 1); > } > > static void kho_init_folio(struct page *page, unsigned int order) > { > unsigned int nr_pages = (1 << order); > > /* Head page gets refcount of 1. */ > set_page_count(page, 1); > > /* For higher order folios, tail pages get a page count of zero. */ > for (unsigned int i = 1; i < nr_pages; i++) > set_page_count(page + i, 0); > > if (order > 0) > prep_compound_page(page, order); > } -- Sincerely yours, Mike.