From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-188.mta1.migadu.com (out-188.mta1.migadu.com [95.215.58.188]) (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 74BB71DE4C7 for ; Wed, 29 Jan 2025 15:53:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.188 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738166040; cv=none; b=WKz8bSxTjUU6q3CiDsdfp2a7uUhEQhQr+YLJv1MEj1d/VeN1Vb1fZd720Rd83APNKcEkP/urV626Ma9lsedPel2Yh6sgcDc/vnRaTzcD08luCjGd77xIZNU22OZPTOeuafQfnCCMX769yY/PQkKFGo+thO3S6TA8eUe6DHYDdgA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738166040; c=relaxed/simple; bh=RBxe0EftsSkXV4Bxc1rBX6CuLsiOsf8N/JcNgV2xH/w=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=EYqGfzymyEM5dPXn7oNC5UpgHVnQuCIhNrEKb9iTsjxMxoJV1efuF7EapccXC+NzGhAidCnJEJ2nsYQOh7dHHozPtpFltEe58IoA/SAnWeC0NKingg2xIHXPSrOIbvgiuHDaEnNMeWP/Ua2jPLWJ0FYofJxZ5LJ8ljcn7SLJt9c= 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=PY2YhJ1C; arc=none smtp.client-ip=95.215.58.188 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="PY2YhJ1C" Date: Wed, 29 Jan 2025 15:53:49 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1738166035; 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: in-reply-to:in-reply-to:references:references; bh=zPbcB/ReL4OJLrfoZPjpuxdzT5Wr23vwCJ1GYQnYaKA=; b=PY2YhJ1CLqzhLcHhDvLmFGnZqszLk/j+3lpD4wH3iLH6Eqj0s+y83j2TBj8FlLhNdVnrHR nG8ltD4cyufr6fEq0Ev+sAw3+Z1xqWkQFTKn6Yu+1R/Gwb1jcUizQ1fcrig+elrs7oeaSD BD+OGdceHlJ+nwr+EmE5A2Q38AcZIu4= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Yosry Ahmed To: Sergey Senozhatsky Cc: Andrew Morton , Minchan Kim , Johannes Weiner , Nhat Pham , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCHv1 0/6] zsmalloc: preemptible object mapping Message-ID: References: <20250129064853.2210753-1-senozhatsky@chromium.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: <20250129064853.2210753-1-senozhatsky@chromium.org> X-Migadu-Flow: FLOW_OUT On Wed, Jan 29, 2025 at 03:43:46PM +0900, Sergey Senozhatsky wrote: > This is Part II of the series [1] that makes zram read() and write() > preemptible. This part focuses only zsmalloc because zsmalloc imposes > atomicity restrictions on its users. One notable example is object > mapping API, which returns with: > a) local CPU lock held > b) zspage rwlock held > > First, zsmalloc is converted to use sleepable RW-"lock" (it's atomic_t > in fact) for zspage migration protection. Second, a new handle mapping > is introduced which doesn't use per-CPU buffers (and hence no local CPU > lock), does fewer memcpy() calls, but requires users to provide a > pointer to temp buffer for object copy-in (when needed). Third, zram is > converted to the new zsmalloc mapping API and thus zram read() becomes > preemptible. > > [1] https://lore.kernel.org/linux-mm/20250127072932.1289973-1-senozhatsky@chromium.org > > RFC -> v1: > - Only zspage->lock (leaf-lock for zs_map_object()) is converted > to a preemptible lock. The rest of the zspool locks remain the > same (Yosry hated with passion the fact that in RFC series all > zspool looks would become preemptible). Hated is a big word here, I was merely concerned about how the locking changes would affect performance :P > - New zs object mapping API (Yosry hated RFC API with passion). > We know have obj_read_begin()/obj_read_end() and obj_write(). > - obj_write() saves extra memcpy() calls for objects that span two > physical pages. > - Dropped zram deferred slot-free-notification handling (I hated > it with passion) > > Sergey Senozhatsky (6): > zsmalloc: factor out pool locking helpers > zsmalloc: factor out size-class locking helpers > zsmalloc: make zspage lock preemptible > zsmalloc: introduce new object mapping API > zram: switch to new zsmalloc object mapping API > zram: add might_sleep to zcomp API > > drivers/block/zram/zcomp.c | 6 +- > drivers/block/zram/zcomp.h | 2 + > drivers/block/zram/zram_drv.c | 28 +-- > include/linux/zsmalloc.h | 8 + > mm/zsmalloc.c | 372 ++++++++++++++++++++++++++-------- > 5 files changed, 311 insertions(+), 105 deletions(-) > > -- > 2.48.1.262.g85cc9f2d1e-goog >