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 7635333F8AA for ; Thu, 9 Jul 2026 11:00:19 +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=1783594820; cv=none; b=O3hXUQkF/kPLQ6zFlg3YpSFDt63ggNwRP6hygA8KvW/rBviRoJY4t7Dwkjt/2kOgTFdxdwwBMa1JfC2yiqHOCuKU26iWmV1cH2hHPOLoOii79OjVXO9P4C3P60BLpNIRi3uvOK/iaLfxIOMqCJbr6vHYQBRztNaBbbbEdKz+Afg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783594820; c=relaxed/simple; bh=L5Hb7EjuCLkt6V2OFXMd/GZHsuHUms3LYSPrQAssuHA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Tdxz+FEdEBeEgTyDNpHVtl0EYxpLi087akjCpzCo5rmnq7AkhpOFpX80GzTk8n3GB8A7DmKWAPZCFh+1nAx0wR9CB9sEQXxbeQjOs/TnXii6oZDXMl+P4REiyjK7P5fKzNAcoZUPsNb4aP+zFlfkcPC9XN2zyiABpfMFcR6IB5k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=RBlISwJq; 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="RBlISwJq" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DC70A1F000E9; Thu, 9 Jul 2026 11:00:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1783594819; bh=NIRIMIqxIBRoAUi+TzoRrEIZ+kOeLqxW4VMnYG6vpJM=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=RBlISwJqs2YqVKjGBoJ3mmQ4DaRDwrSPoF5W++7Hzrwz4c13bMoEWcxdhWoeVT7Yn wuvE3qGGNmmSzcahSfSZeYHBWnbbUphVhHmbvytp8lDwWCrSqk0xnGIcJGrkZJRA3I JzJDfQHyR2LnfUZK5V9n8R6BBkMe7pvyS+K6CugynwiPHMGFbXJhiDKhZIRLZe+zLA p2fnpOH/iA/NEFOMM2SmUCg0jcfiFfK7H72NUeQB3Au8Gxgk/g+xEwGeeR1wbSVzvs XPY2Brh9V6mMDNLIk2/COjzXz6r6MN7t/L5EGQfmpH6+7qp7EIcHKnIBr56/qCK1Xb EGb+J2DdZHURA== Date: Thu, 9 Jul 2026 14:00:12 +0300 From: Mike Rapoport To: Pratyush Yadav Cc: Pranjal Shrivastava , Samiullah Khawaja , Pasha Tatashin , Alexander Graf , David Matlack , kexec@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH 0/4] kho: Support preserving unsplit high-order pages Message-ID: References: <20260703020832.1731864-1-praan@google.com> <2vxz7bn5mv0n.fsf@kernel.org> <2vxzy0fll71f.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: <2vxzy0fll71f.fsf@kernel.org> On Wed, Jul 08, 2026 at 07:34:20PM +0200, Pratyush Yadav wrote: > On Wed, Jul 08 2026, Pranjal Shrivastava wrote: > > On Wed, Jul 08, 2026 at 04:36:46PM +0000, Samiullah Khawaja wrote: > >> > >> I think this makes sense. The mm already relies on the allocator to > >> track the type of pages it has and expectes it to use free_pages or > >> put_page() or free_page(), so it is natural for KHO to rely on the > >> caller to call the right restore API. > >> > >> Lets add kho_preserve/restore_page_contig|_order|_nonsplit and the dma > >> preservation can use the appropriate one during restore. > > > > Ack. I like kho_restore_contig, I don't think we'll need a preserve for > > Dunno, everything is contiguous, folio, 0-order pages, higher order > pages. So not exactly the best name. > > Since you'd get these pages via alloc_pages, perhaps > kho_preserve_pages() works better for this kind of allocation, and for > the _current_ kho_preserve_pages(), we can rename it to > kho_preserve_split_pages()? It is a bit too wordy though, so that's a > downside. > > Mike, you are better than me at naming things, so do you perhaps have > any better ideas? :-) Thank you for the compliment, but I'm drawing blank on this one :) The best I could come up with is to kho_preserve_page_range() for order-0 pages. > > this though? Preserve doesn't seem to be preserving refcounts, I guess > > we could rely on kho_preserve_pages and the caller can use > > kho_restore_pages_contig() to set refcount correctly for unsplit pages? > > No, kho_preserve_pages() can split the preservations in unexpected ways. > While for a high order pages the current algorithm _shouldn't_ do it, it > is simpler to just add a new preservation function. > > Move things out into helpers if you want to avoid duplication, though at > first glance I don't think there should be much. Right, preserving compound pages is more similar to preserving folios actually. > -- > Regards, > Pratyush Yadav -- Sincerely yours, Mike.