From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4C9593D6CD7 for ; Wed, 22 Jul 2026 21:20:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784755226; cv=none; b=rntImC4x5NpP+Iqqz3AGUlSePaiLnzO4j3I/pwAKb52rXMYU4lwvL1Ppiv9odA8FMkOs7khAm7O+rFahJ+wJMw8YyTI9dAJQzte6lqwR5O6ebmBuWk8ZFMVjggwsj56TeyJDFVnUU7bxBVXEl9scB1zi45TcopMtW1fFIJAXQac= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784755226; c=relaxed/simple; bh=il/Fy860cFx6147qd2a0IDUVAujba/6tPMfI1zPMEhU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=onJlRhZuWITnwHcRtoVHfhmOAqgFErMHlv8ElqDI7VU3Oe3A5wFm+PruG2LJNRMvxEPKwIKPDAHA3Tme5ly9iijduGJF9dYN7r3Z0AT/VFiWocdfe8RSH+lyseelhupuVocZLjhrXPaKkmcmGp6xTNNoBtjCv/qdtS0S/thfrXI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=nBuSW4CZ; arc=none smtp.client-ip=209.85.214.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="nBuSW4CZ" Received: by mail-pl1-f176.google.com with SMTP id d9443c01a7336-2cede6375caso26855ad.0 for ; Wed, 22 Jul 2026 14:20:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1784755224; x=1785360024; darn=vger.kernel.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=77lCXIJOUcG7tXFVWP1KPzJcluoW+7zUs7HIRFXD6Pc=; b=nBuSW4CZ8prZnwvKEsP5/XEtNBi5mmUOI5Fib4J8aIvAfUelOs++y1Ae81XTUp7tAX vvq8QNay9pzk3Mik9bRAdzGZniksaQ/yG9NiHXm6deFQWY900NE1W4a7dvfFgBsYeq3R Mf3gg6G8zyrCxT3ODic2E7K+OhTp0SWiGEqo2ISByuhhvx8P9WOkgr7ZhoG7qOWwO08Z g6vq+RLZ3MGtGcpo6f3cBD8IP6QNSFmtz9/xTQ1YBu+NUt/cDro8fD1CRFtpaqZrwbjk RS0vn0M6TZ6NzTZuVLHcREX9cGtkklvaw1wyBm0teHx1RA34Sng3cOtb218xewxTRwAt oPZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784755224; x=1785360024; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=77lCXIJOUcG7tXFVWP1KPzJcluoW+7zUs7HIRFXD6Pc=; b=R177cPEzRVw/+Rh+uy/DSWJhKqDT7mesLcU+U4SBAS/F1oLCAjnz1i0OtkbBwAHs+e 4h19xv2T6O35fKG5cqLQnGRYj6LAY/XIRuSxG5gHwfxOFkwK0ZnvkgRTIolHaAnnGQjF z4tT76c6j2pwzjEnV0fuilR8jW4pH/sra9E7w/6xNokj6dIwM+i9o9kusasHCpOzqwm6 h0evmTChnQBszVYodEfiusikzN0MwXlRgiUH9Bx3XoKEi47RZh7NgbJy16KMWL7Nz1qa ojyNAClkN0QtVamyz3G/zzhQISPsvxkDEB2cAaS6al2/uyQx4VPX5IwQ3j43mkqpq3Oc epyw== X-Forwarded-Encrypted: i=1; AHgh+RqBtaU8OpRU7ixwRQyZA+pswNHrgM512CDsmAnW8ko2hAY8b6zWZ8v65PakvJ6S+5wipQIL/NKDfkekIbA=@vger.kernel.org X-Gm-Message-State: AOJu0YwGnWDu4uFT4zohVmcDkiKDt0HG6x5fbZQ9+fOVipui8kMSrjkM D5cjaBcpZLkcwx7pVfBEoGC8xMNCtrZkaA1/7tsXcy9L3P4VeNIgJB4t4oNQsB9WDw== X-Gm-Gg: AR+sD12BidlBmASDItmjdiQuUt1DyNGS1agqaD2vXe47hdn7UtHS1KM5B213NmDWHSZ 6300EZXDgxAz+WqAI6TGCTNnGo4XKeQLIb/4zavrZ+Ynvme55sOITN494wqA4KxGG6S+IsfLEhY RgIa+VsP7WGqWo+VLmElMd9g+JrGTCXVGATB0ROy3Y8kebzWO/7AXL76sbJxJR0wREiSJQOVwBV cWgJ8Gmla67wGfpQdco3gZpRp+hDPqbzTC+PBFJtXrRZ8nvWqX9IeJcSQ/SfTgyDR72cG48CnZ8 8OEaYje4bRns41dcAlLltmaDO0cOHOf6HI8GfHf9/0mKKt0Cqj7c5tx0O7lUc6zWjOHBbXKG360 hMKlZQPzUg48DRigd+yeOcWimbsFlli3XSVF2cm9aT+qEOB4ySNyANKZFogUtNzj0wX6joVAcRE +0D9EY9WTSY6iLzXT7Ypz5BVN4nhlxYqEBXI7z X-Received: by 2002:a17:902:c40d:b0:2c6:99be:9dd with SMTP id d9443c01a7336-2cfa4e71220mr1307355ad.12.1784755224018; Wed, 22 Jul 2026 14:20:24 -0700 (PDT) Received: from google.com (10.129.124.34.bc.googleusercontent.com. [34.124.129.10]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-3147d47960dsm11985348eec.0.2026.07.22.14.20.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jul 2026 14:20:23 -0700 (PDT) Date: Wed, 22 Jul 2026 21:19:53 +0000 From: Pranjal Shrivastava To: Mike Rapoport Cc: 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: [RFC PATCH v2 2/2] kho: Introduce preserve/restore APIs for unsplit pages Message-ID: References: <20260713204935.3069000-1-praan@google.com> <20260713204935.3069000-3-praan@google.com> <178456663513.143128.14871307686052703561.b4-review@b4> 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: <178456663513.143128.14871307686052703561.b4-review@b4> On Mon, Jul 20, 2026 at 07:57:15PM +0300, Mike Rapoport 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 unsplit pages, > > high-order non-compound ^ > Ack, will update the commit msg. > > 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(). > > > > Signed-off-by: Pranjal Shrivastava > > > > diff --git a/include/linux/kexec_handover.h b/include/linux/kexec_handover.h > > index 8968c56d2d73e..6e2c75b16209c 100644 > > --- a/include/linux/kexec_handover.h > > +++ b/include/linux/kexec_handover.h > > @@ -22,6 +22,8 @@ bool is_kho_boot(void); > > [...] > > +struct page *kho_restore_page(phys_addr_t phys) > > +{ > > + struct page *page = pfn_to_online_page(PHYS_PFN(phys)); > > + unsigned long nr_pages; > > + union kho_page_info info; > > + > > + if (!page) > > + return NULL; > > + > > + info.page_private = page->private; > > + if (WARN_ON_ONCE(info.magic != KHO_PAGE_MAGIC)) > > + return NULL; > > + > > + nr_pages = (1UL << info.order); > > + page->private = 0; > > + > > + kho_init_unsplit_pages(page, info.order); > > + adjust_managed_page_count(page, nr_pages); > > + > > + return page; > > Hmm, it copies a lot from __kho_init_page(). > We should keep the common part of order-0 page/folio/high-order page > initialization in a single place. > Alright, I'll break out a helper. Thanks, Praan