From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) (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 2F4C63126B2 for ; Wed, 22 Jul 2026 09:43:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.95.11.211 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784713439; cv=none; b=lypagRTof74c5ttHqLgS7FwU91b+BaNJngM8Jjj+95YtEGSL+H263qPLkjAWKlv3wbVv2M4dzPdr7ALuonVPR63EOb2UtQ25evYUilMIpA0QAycl6zQkQhoY6JfRzBl7yp5G5Cg9wy8u4Le31D3RfjZRm4M5tBNOyEOCoyTUtjY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784713439; c=relaxed/simple; bh=Z/vnS3jKVr2U0OQlxBPo9zJ5nbDSq/qv2qcCFmNnSKs=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=H/YuxEajMacOopDUpdRTqvl+0D+r1a7L9V/cOGVtP7AT30UyrVaTuDKZQG5FY3OxxqWR6fY+gRoMhnc71YtuwA+ukZpHfsBg85sL5LJ0+oqCbrqmE66pTnP5FLLl1sKzy/ulrQLY3s+5KA2pnEZ4o4TS5po6iN1ayLLZO5roZdk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lst.de; spf=pass smtp.mailfrom=lst.de; arc=none smtp.client-ip=213.95.11.211 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lst.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lst.de Received: by verein.lst.de (Postfix, from userid 2407) id 88ADA68C4E; Wed, 22 Jul 2026 11:43:50 +0200 (CEST) Date: Wed, 22 Jul 2026 11:43:50 +0200 From: Christoph Hellwig To: Matthew Brost Cc: intel-xe@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Hugh Dickins , Baolin Wang , Andrew Morton , Christian Koenig , Huang Rui , Matthew Auld , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Christoph Hellwig Subject: Re: [PATCH 1/2] mm/shmem: add shmem_backup_folio() helper Message-ID: <20260722094350.GA1057@lst.de> References: <20260721174723.1039395-1-matthew.brost@intel.com> 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: <20260721174723.1039395-1-matthew.brost@intel.com> User-Agent: Mutt/1.5.17 (2007-11-01) On Tue, Jul 21, 2026 at 10:47:22AM -0700, Matthew Brost wrote: > Add a new generic helper, shmem_backup_folio(), that copies the pages > of an arbitrary source folio into a range of a shmem-backed file, > optionally issuing writeback for each destination folio. It is > extracted from drivers/gpu/drm/ttm's existing shmem-backup loop so > that other subsystems (starting with TTM in a follow-up patch) can > share the same implementation. Hmm, what is the difference to just doing a ITER_BVEC write with a bvec containing the folio for this the pure write to shmem part of this? You'd probably want a kernel_write_iter helper wrapping __kernel_write_iter for the writecount, but otherwise this sounds like a normal write. We'd want something for the writeback part, preferably a purely range based API to be generic.