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 6C6A0430CD8 for ; Wed, 12 Aug 2026 11:10:27 +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=1786533028; cv=none; b=sIfcJ6/7h521Z+rtnZ2P+PovVzyqrXNSWOyu4eBIsPCPBw1BJilSSJjr45FWNDvVt4K56dZv18ZYOwduX2gTr+W0ACn2/NveRIoB/mMp4QeoBtjDkg1vxTa9iBV568rmF5xWg1ZifvXBdGQpIfcPhsoD0oE9S+2eMy6qYWn5gEE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786533028; c=relaxed/simple; bh=mjvn4BjJRdG8QTkPteGR8K0E1i9zQ7laA6X88oMqK2g=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=VyS7ijmYEHP55mkvexmVUNnojSfViOTiolfqBIbs8WQQOsGbrehpLUzmp4wfIi6yEmtPz3//M/ArrkaDUnKOPy/sWet/1g0SYl5dwsshPODDyrnswKW8P34d1ghybyvK1gyDnLPlmLkwi8zVsbWheaJATfltLXiUG//Qg9tgQpI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=WYd2zt8t; 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="WYd2zt8t" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5D8941F000E9; Wed, 12 Aug 2026 11:10:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1786533027; bh=lnwlG71sjI06zsq7yj3kdlhgqiN/yez8QEYIr9vq9zU=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=WYd2zt8tfz9f3l7W2MEvjC9PgjvttrZRZQVu40gKcm//Lc2oh3g67LBMStlLwpfhS xMQicXNXtVelpILEAADkxgCYL9BvY84p7BepdW1igypoiA/RTrx9ZoHqQzeH9LzhNX fFGCwLPk5SyGU+QOnoKQ5AJxqETgroS26+gZ9FeDb2c9/tgO0+uDSA3AuIbv0SG8Lr lJESY+GMBNpPY8804d2TiZWZe3JjdQSimESxZtndotoBUjylLoQO3lxy2eco2WxcLF n+yRKhPGPH/SONjna1QhUFRHOduSa5v7P3vbI4WsU1U9gscXN1ALeSmiWs6bN71fcL ssDCkH9AWO2ew== From: Pratyush Yadav To: Pranjal Shrivastava Cc: Mike Rapoport , Pasha Tatashin , Pratyush Yadav , Alexander Graf , Samiullah Khawaja , David Matlack , kexec@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v4 2/2] kho: Introduce preserve/restore APIs for high-order pages In-Reply-To: <20260803113944.3694290-3-praan@google.com> (Pranjal Shrivastava's message of "Mon, 3 Aug 2026 11:39:43 +0000") References: <20260803113944.3694290-1-praan@google.com> <20260803113944.3694290-3-praan@google.com> Date: Wed, 12 Aug 2026 13:10:23 +0200 Message-ID: <2vxzmrur3880.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 Mon, Aug 03 2026, Pranjal Shrivastava wrote: > The current KHO page preservation APIs (e.g. kho_preserve_pages) assume > that multi-page blocks are split into independent 4KB pages during > restoration. This is incompatible with high-order non-compound pages, > such as DMA buffers, which must be restored with tail pages having a > zero reference count. > > Introduce explicit preserve and restore APIs for high-order pages, > which preserve and restore a high-order page block as a single unit, > applying a refcount of 1 to the head page while leaving tail pages at 0. > Rename the existing internal helper to __kho_restore_page() and > consolidate the common restoration code into it. > > Signed-off-by: Pranjal Shrivastava The code here looks very convoluted TBH. I think it will be simpler to make kho_restore_page() only return non-compound pages. That is, it returns 0 or higher order non-compound page. Then kho_restore_pages() can call kho_restore_page() and then do split_page() on the page it got to turn it into 0-order pages. kho_restore_folio() can call kho_restore_page() and then do prep_compound_page() on the page it got. And then you expose kho_restore_page() to be used by DMA APIs to get non-compound high order pages directly. How does that sound? [...] -- Regards, Pratyush Yadav