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 1BF0AC021B1 for ; Thu, 20 Feb 2025 17:32:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AC1672802FC; Thu, 20 Feb 2025 12:32:58 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A70F82802D6; Thu, 20 Feb 2025 12:32:58 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 93AA22802FC; Thu, 20 Feb 2025 12:32:58 -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 735132802D6 for ; Thu, 20 Feb 2025 12:32:58 -0500 (EST) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 248E9B8622 for ; Thu, 20 Feb 2025 17:32:58 +0000 (UTC) X-FDA: 83141018436.26.591461A Received: from out-183.mta0.migadu.com (out-183.mta0.migadu.com [91.218.175.183]) by imf26.hostedemail.com (Postfix) with ESMTP id 0FC9D140018 for ; Thu, 20 Feb 2025 17:32:55 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=LgJ3PuFL; spf=pass (imf26.hostedemail.com: domain of yosry.ahmed@linux.dev designates 91.218.175.183 as permitted sender) smtp.mailfrom=yosry.ahmed@linux.dev; dmarc=pass (policy=none) header.from=linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1740072776; 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=xLm69d1JiwcbIZY6/XZSqzpJmY2k5MyhEqHGfOITQ9s=; b=vwhAaJv/Lfc/QuPbK2a5lcgCdR9WDDxE+URGoUoYWZCQPxrKso4/WMXPOh+LjVL9+1YowQ FbvV/3R1wNE+BunnNB5COCDiwpiWpbfBLc8aWQXjge7Sn9NHrg5zW0sSucsuEJ6YgYzWNm AAZfq1q/6d9UTZQm+Ij+kggenKTZ8a0= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=LgJ3PuFL; spf=pass (imf26.hostedemail.com: domain of yosry.ahmed@linux.dev designates 91.218.175.183 as permitted sender) smtp.mailfrom=yosry.ahmed@linux.dev; dmarc=pass (policy=none) header.from=linux.dev ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1740072776; a=rsa-sha256; cv=none; b=glbBGSSz8odVtExdKHfP/L1ZErQHNFNkko/+roqw1QKdWjkbkJkzC6EJk3BaU4ZnMmm1JM 5tLlh/SvOQvaMVL8gklnZ/lSqDDWVo9uRbPpWz2IEm2WkW2MMsz+RxlJ3tdXr3poXMcQhq 9AHK51WRX1sFDxRrQ7kDQipDucN47qc= Date: Thu, 20 Feb 2025 17:32:46 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1740072773; 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=xLm69d1JiwcbIZY6/XZSqzpJmY2k5MyhEqHGfOITQ9s=; b=LgJ3PuFLOrdaWsTT71dZDT4Wpah6l8pxu2DAGVwXprSS3+5upKrW4KsW9WV12UvGqwXSPL v4yh5KHpFtiBETrfIWZRsFnhxO1dKnnBNVS0svJ/Jzgu/LufyFsVlS5Ou7FHV1iqbEJU5W ooAdSfemj1nsxTESalAjavU8an1FqZ4= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Yosry Ahmed To: Herbert Xu , Barry Song <21cnbao@gmail.com> 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-Migadu-Flow: FLOW_OUT X-Rspam-User: X-Rspamd-Queue-Id: 0FC9D140018 X-Stat-Signature: cms3ia3muh7tykkgtafgxob76uoxx916 X-Rspamd-Server: rspam03 X-HE-Tag: 1740072775-111188 X-HE-Meta: U2FsdGVkX1/38pzENB7YUcSkAocQKzkvUI21psc+B78xr7eT8q9LOpFyShADEoZzOk/t9klFUaj00NDqEupstbDoBPO2ZO7nBp2qTJCxy2NpuBFEdFRtXwiLFscjlcPuv4aNa1L/LiScOz11Yk8sSv3PSJiPzrTdF0Hb4ML4WdKWr7D/oagIvoWvvprbJtTGhIxtf4z//3rd+u1g5/yXgoomCOPQtW2I+pkqM88qO371xPJSh7ki7J0qH40y/2o41gOI91s4wNuJSy7ZxYV+o38h6J163cKZtL3zhaMd8xZ7EBQhWDV/lZ0SJHxEYEARQ9EOkboygbX8Hcd4l7SP13BIGJvXIZX8umkRAcic7IZlx07KXDJkJ0ZAWfw8PcTkCmbTdYTykCYnMGX7PLdPq/u9kGfe2kZAR/zjRfxYgoUEbUEaybIL6RCbk40Azo/+3Ry7i6klhiPHk84UYfhB5kyir1KW0J1QwgnfVqXzKZ1KZLFiIKoGezw/DvZmIx2ouzvrnkAftCERQQzTI30Zpn0zjrV5kMh83V7vpemzBoLoglefrWXKEge+pd5AxI/Egdnom/bjfv22Tog1pYwFK6CnnuAeS7IIwK9UWQjGYVTJmnfg12x76sO3WGO7ye+OIz+tLg0/6Pe+2iH64fO4vr8tpYpFUPxOb7zgXj6Zn0ScXH2bcFu5TQcz/xpv96TMxD2YYmbzE9/AxPLug2Oz+8GeR7HuXNADiSNZBMMzFzZCu48FQrg/jzB+kV1SnWi32WrBCSB0GX5x7G9Cv37LIHQkDKnKvksVlmUKYpmyVHtqnwCEceLAhrQvGmAv+kyq78gI9WJSZMcQFTXKmsnhnjokO3pas3TpnDEFxVjffTjH+wc/OrYhw6PBmZFxqzbsnsQbw+NLdB+UMENNWHGergNR2shgFMXhiTvOb8uoHbfAFLlxU38e1GG8Ah5x6hlYPHdv+o4KVFFkSmwk7G0 TJjD0XCW mTiYfn8PRrxxXup/XLuEIY48/Hl3R49vPbvse8aEjOZmUa8f370zl7ez4nQ/5E7VQuIf+YSAjZ167ZYjWO8rQLYrHxCTTYIg9UEMgxZyVeW/viBBs9EGSwp4tlq+PMmA9EbevbHEDCU657afmpHEBsVXhfA+/HACitPjF6114YRCvR1JHj24U7Ue31dhQdpF36DDyAufLSviDie9g/t8kUQzAUkIURUxeCEKFY5PyO8qL5x5kraYO+bASq0ZTZOXFPQtBqaBfNVopTW8PXu3tmJPW83xZDHudAy17nvwuAwgpFO9oBOZX9E03zHJJ+rBmwCwkazQI4wXWwa+wQDngEvDGGUESnsujmbMIZSMu0HDXK/N+0F+tXumk6kraG/7pwpVhv2tLK/DEcbYcZBmwFrrdTg1Ol7G9j/nb5XCEViw4KAVjp4mqIjObPg== 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 Sun, Feb 16, 2025 at 01:17:59PM +0800, Herbert Xu wrote: > 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. I agree this should be fixed if it can be. This was discussed before here: https://lore.kernel.org/lkml/CAGsJ_4wuTZcGurby9h4PU2DwFaiEKB4bxuycaeyz3bPw3jSX3A@mail.gmail.com/ Barry is the one who brought up why we need PAGE_SIZE*2. Barry, could you please chime in here? > > Cheers, > -- > Email: Herbert Xu > Home Page: http://gondor.apana.org.au/~herbert/ > PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt >