From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-187.mta1.migadu.com (out-187.mta1.migadu.com [95.215.58.187]) (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 8CF8F1850A4 for ; Sat, 17 Jan 2026 03:23:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.187 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768620213; cv=none; b=UwZatf5v+XVsJmb7VFrskTS5pBhSQWvGzFP5PmJwdTH91HnMqGhcKDL7jNwK56zww0A3frIbxORAT9hhIJNb0QfdXM3nZwJMX5DRiHRhman6uad4gTvXo8Lv7YbNe3ww85ekxJ8yz0awYvt8HfWGxqSqEzh6+2azQlH/SWUU+1Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768620213; c=relaxed/simple; bh=4+NbRRp/rV7+xXzNE8U/83GOHKK7XOnkM4Kh3Z66fXA=; h=MIME-Version:Date:Content-Type:From:Message-ID:Subject:To:Cc: In-Reply-To:References; b=XDyJzofnzY6hMCaBv7EgXWVVjQYxreAEHQ4lDOHJqNgsuYeSjbSy3Hx4t1NK/Gj+u6fvRBOgk8kRGpcpowCsm+BRpAL1X9Xiz0XQymqw/6b9IVLiSNZrRetoEOBsICRgfmVEJkFj34sgChHTFLXD13eocplGAwN6+GtXg7rV78o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=GxbLQWF7; arc=none smtp.client-ip=95.215.58.187 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="GxbLQWF7" Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1768620209; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hQuEhl8zHrQZCagraBktkM4tCNhuhThzyRBFv9qmF9M=; b=GxbLQWF7/wKOkO85QVUmYAus/Jai2RXrC4MUcTfctHah/9Z82GSaYvH0RQ+oiUBQzfrYi/ qaKBX1EkLO8SSIvjyszEQfRo0+0CJ5Wui4qeLNZD/8M1H9hsEUCLF/y2aAynbZFJH7ad1O kduO05075Ev8wM6P8qTxmabGDl2Oqlg= Date: Sat, 17 Jan 2026 03:23:26 +0000 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: "Yosry Ahmed" Message-ID: TLS-Required: No Subject: Re: [PATCH] zsmalloc: introduce SG-list based object read API To: "Sergey Senozhatsky" Cc: "Sergey Senozhatsky" , "Andrew Morton" , "Minchan Kim" , "Nhat Pham" , "Johannes Weiner" , "Brian Geffon" , linux-kernel@vger.kernel.org, linux-mm@kvack.org, "Herbert Xu" In-Reply-To: References: <20260113034645.2729998-1-senozhatsky@chromium.org> X-Migadu-Flow: FLOW_OUT January 16, 2026 at 6:39 PM, "Sergey Senozhatsky" wrote: >=20 >=20On (26/01/16 19:53), Yosry Ahmed wrote: > [..] >=20 >=20>=20 >=20> struct zs_pool *zs_create_pool(const char *name); > > void zs_destroy_pool(struct zs_pool *pool); > > @@ -43,6 +44,9 @@ void *zs_obj_read_begin(struct zs_pool *pool, unsi= gned long handle, > > size_t mem_len, void *local_copy); > > void zs_obj_read_end(struct zs_pool *pool, unsigned long handle, > > size_t mem_len, void *handle_mem); > > +int zs_obj_read_sg_begin(struct zs_pool *pool, unsigned long handle= , > >=20=20 >=20> void? The return value is always 0. > >=20 >=20I thought about returning sg_nents(). Probably can be just void after= all. We don't need it for zswap but it could be useful for zram. >=20 >=20>=20 >=20> There is a lot of duplication between this and zs_obj_read_begin().= I > > wanted to create a common helper for them both that returns the zpde= sc > > and offset, but we cannot do the same on the read end side as the un= lock > > needs to happen after kunmap() in zs_obj_read_end(). > >=20=20 >=20> Putting parts of this code in helpers makes it a bit obscure due t= o the > > locking rules :/ > >=20=20 >=20> I wonder if we can drop zs_obj_read_*() and move the spanning logi= c into > > zram. Looking at zram code, seems like read_from_zspool_raw() and > > read_incompressible_page() just copy the return address, so I think = they > > can trivially move to using the SG list helpers and > > memcpy_from_sglist(). > >=20=20 >=20> The only non-trivial caller is read_compressed_page(), because it = passes > > the compressed object to zcomp. So I think we only need to handle th= e > > linearization there, something like this (completely untested): > >=20 >=20So I was thinking about leaving things as they currently are for this > dev cycle, because both zram and zsmalloc have enough of new code queue= d > up. If you don't mind let's remove memcpy() API and convert zram during > next cycle (after the upcoming merge window). Sure. I think we can do all of it in a single series for the next cycle. = Add SG interfaces, convert zswap and zram, and remove the old interfaces.