From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-170.mta1.migadu.com (out-170.mta1.migadu.com [95.215.58.170]) (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 8A5971A83EF for ; Mon, 27 Jan 2025 21:26:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.170 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738013199; cv=none; b=cKLJVHj04lZ55SWvL1geI6kefAxuI4kEINTyNftWTmyxVd9zqM1hnLIzBWnoX40Fnc4MjvjDurRtBP0+r1Ri+1Vs83qY4AFpohPKiXq3RcboGPGPE5YAOcN9CTMB9qTecZIVxNJ+EXtyKNuryYbsSD5Qvl647+ejEkkH+CY4oDQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738013199; c=relaxed/simple; bh=isy+LvGwWCp7Pc5sHv+zGzNxTj+zyLvmeGFZIR3DFFk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=pAuis+ftqJtCMJ02Edc78oHKvmGtF3j331vaoIvyZquiI/SkSofdRzK3U3hRSLFmEvZePA/wTvI0yZA9J2gw68nR6DQ8qHuZz8CeCPgcwdceAT86KZ0XTU3nDv5QACH4OT3motCsC8r19P1oO6mcAanTHCX9/jmVljCqR+p0UVE= 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=IQrRPW2S; arc=none smtp.client-ip=95.215.58.170 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="IQrRPW2S" Date: Mon, 27 Jan 2025 21:26:29 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1738013194; 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=uXwEPE/52JkpixkvFVWvAS0Zi9Iu27iNteQgb1EfYMo=; b=IQrRPW2SjK+48lg3P8z6j21oBv2r79aUfXVWuusmOhsZrKyyjKFsmPVCHlgGBbA0u5tZg8 xy/jzsvRvJpOzsswjjFlLCccCc/1nk7hhg8a5joJh3aUaDP6RjiVnYJB7LjwXlXMCz9ZeH S6TYh4VGIIwMZWu2jLTBsLlQ96XSb1c= 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: [RFC PATCH 5/6] zsmalloc: introduce handle mapping API Message-ID: References: <20250127080254.1302026-1-senozhatsky@chromium.org> <20250127080254.1302026-6-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: <20250127080254.1302026-6-senozhatsky@chromium.org> X-Migadu-Flow: FLOW_OUT On Mon, Jan 27, 2025 at 04:59:30PM +0900, Sergey Senozhatsky wrote: > Introduce new API to map/unmap zsmalloc handle/object. The key > difference is that this API does not impose atomicity restrictions > on its users, unlike zs_map_object() which returns with page-faults > and preemption disabled I think that's not entirely accurate, see below. [..] > @@ -1309,12 +1297,14 @@ void *zs_map_object(struct zs_pool *pool, unsigned long handle, > goto out; > } > > - /* this object spans two pages */ > - zpdescs[0] = zpdesc; > - zpdescs[1] = get_next_zpdesc(zpdesc); > - BUG_ON(!zpdescs[1]); > + ret = area->vm_buf; > + /* disable page faults to match kmap_local_page() return conditions */ > + pagefault_disable(); Is this accurate/necessary? I am looking at kmap_local_page() and I don't see it. Maybe that's remnant from the old code using kmap_atomic()? > + if (mm != ZS_MM_WO) { > + /* this object spans two pages */ > + zs_obj_copyin(area->vm_buf, zpdesc, off, class->size); > + } > > - ret = __zs_map_object(area, zpdescs, off, class->size); > out: > if (likely(!ZsHugePage(zspage))) > ret += ZS_HANDLE_SIZE;