From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id EA6C6C02198 for ; Sun, 16 Feb 2025 05:18:09 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 61F4928001E; Sun, 16 Feb 2025 00:18:09 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5CEEE28001A; Sun, 16 Feb 2025 00:18:09 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 496FC28001E; Sun, 16 Feb 2025 00:18:09 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 2C0A428001A for ; Sun, 16 Feb 2025 00:18:09 -0500 (EST) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id A14798188A for ; Sun, 16 Feb 2025 05:18:08 +0000 (UTC) X-FDA: 83124651456.21.0336E43 Received: from abb.hmeau.com (abb.hmeau.com [144.6.53.87]) by imf22.hostedemail.com (Postfix) with ESMTP id 891DCC0004 for ; Sun, 16 Feb 2025 05:18:06 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=hmeau.com header.s=formenos header.b=BF119Psl; spf=pass (imf22.hostedemail.com: domain of herbert@gondor.apana.org.au designates 144.6.53.87 as permitted sender) smtp.mailfrom=herbert@gondor.apana.org.au; dmarc=pass (policy=quarantine) header.from=apana.org.au ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1739683087; a=rsa-sha256; cv=none; b=a3dlSXb3VwUWExUAh9b4l0SWR0HlH7wRXqd/Z2nHwDDa0Nn9D7xdSY3Jfm540EotEGc/0k vqGi7iqJ2n1zT2IhnNDTH0W7b8bcjA6K7AIPl1ae4mBKtQY3y54hRFZ/0eNQKa2your2b+ tNbNFwVk4Pbo0qtMDydMUarwwKCXHG4= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=hmeau.com header.s=formenos header.b=BF119Psl; spf=pass (imf22.hostedemail.com: domain of herbert@gondor.apana.org.au designates 144.6.53.87 as permitted sender) smtp.mailfrom=herbert@gondor.apana.org.au; dmarc=pass (policy=quarantine) header.from=apana.org.au ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1739683087; h=from:from:sender: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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=ltEpkMdVnehiq7zLE8+9J4AaK7cG1Lq4CxOYTIUDLdE=; b=MU9jSaNMuF+M4gAZHM/LUYoIrFj5gWR2dQmtwOmYGJInBYjHYgiWntyhmvld04zw98g0mi SgP2Le4ShlsnCxH2vTdLfmIajWcdKNTVdsf29XIqW7svbXxU09GOxvScQieBg389MfRMUL fm1ZEaZvy7RAeKRwpccdapSxsQsJUDQ= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=hmeau.com; s=formenos; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=ltEpkMdVnehiq7zLE8+9J4AaK7cG1Lq4CxOYTIUDLdE=; b=BF119PslGUH+jXcMNSUETyYs9g /ptsvgS/sC5LGW582/ION2X6TuFq7iyZwLbebQJbChHf3cBNq56Jwi3/CdbEJjSVjsEUxfZy9C24k TraTZLmex7rDI2ezduRt2ZcoASF0y6CQx1U7ToyM9WxIucbexMeVf8thZn6o0xejSf3Bc4uvWPtqv XSKTUJ7znWqxI4SAdgpwxatW8TFDAGLB9xpI3XL80s5XK1jHDaEXpiHBS78wlRRrxL3Af+ISVgXsM fhg7cbCU/qs16aK3CaFvaVUq2yfPRC/vsziEvRmx30UeMWLi/vFryavb7wqo7qQFvJW9fEEujrbOE yWIx+5Yw==; Received: from loth.rohan.me.apana.org.au ([192.168.167.2]) by formenos.hmeau.com with smtp (Exim 4.96 #2 (Debian)) id 1tjWpa-000hHM-1O; Sun, 16 Feb 2025 13:18:00 +0800 Received: by loth.rohan.me.apana.org.au (sSMTP sendmail emulation); Sun, 16 Feb 2025 13:17:59 +0800 Date: Sun, 16 Feb 2025 13:17:59 +0800 From: Herbert Xu To: Yosry Ahmed Cc: "Sridhar, Kanchana P" , "linux-kernel@vger.kernel.org" , "linux-mm@kvack.org" , "hannes@cmpxchg.org" , "nphamcs@gmail.com" , "chengming.zhou@linux.dev" , "usamaarif642@gmail.com" , "ryan.roberts@arm.com" , "21cnbao@gmail.com" <21cnbao@gmail.com>, "akpm@linux-foundation.org" , "linux-crypto@vger.kernel.org" , "davem@davemloft.net" , "clabbe@baylibre.com" , "ardb@kernel.org" , "ebiggers@google.com" , "surenb@google.com" , "Accardi, Kristen C" , "Feghali, Wajdi K" , "Gopal, Vinodh" Subject: Re: [PATCH v5 02/12] crypto: acomp - Define new interfaces for compress/decompress batching. Message-ID: References: <20241221063119.29140-1-kanchana.p.sridhar@intel.com> <20241221063119.29140-3-kanchana.p.sridhar@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 891DCC0004 X-Stat-Signature: uufcfjxbhdfsxxa4ttsyoqyox443ptzy X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1739683086-155128 X-HE-Meta: U2FsdGVkX19hUKUhTk+Zip5mYhUlD3/s/PIsLOp377HTvEEs9ZzOP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OMCYpWLqZuJQsXQpIXkAx61Mdiy8ezCMzLePJGVjuMUVzJDR6KWrEZnhFhduvYHB0xkVt8I1tvyAItH1gJzjc9VB7YhtdTwRpU+rq8ztDu/AgKRIRmCJ5YQ6q54MUYizIdIZ+p8ZlayKQwesv4n2zH9xzIEate+VkwPNXNNIT4AuyHjyQX8TU9ztD77Von6nQb8o4cys4gew== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Mon, Jan 06, 2025 at 07:10:53PM -0800, Yosry Ahmed wrote: > > The main problem is memory usage. Zswap needs a PAGE_SIZE*2-sized > buffer for each request on each CPU. We preallocate these buffers to > avoid trying to allocate this much memory in the reclaim path (i.e. > potentially allocating two pages to reclaim one). Actually this PAGE_SIZE * 2 thing baffles me. Why would you allocate more memory than the input? The comment says that it's because certain hardware accelerators will disregard the output buffer length, but surely that's just a bug in the driver? Which driver does this? We should fix it or remove it if it's writing output with no regard to the maximum length. You should only ever need PAGE_SIZE for the output buffer, if the output exceeds that then just fail the compression. Cheers, -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt