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 B51C7E6C614 for ; Tue, 3 Dec 2024 08:00:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 319A26B007B; Tue, 3 Dec 2024 03:00:51 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2C92D6B0083; Tue, 3 Dec 2024 03:00:51 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 16A376B0085; Tue, 3 Dec 2024 03:00:51 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id ED4466B007B for ; Tue, 3 Dec 2024 03:00:50 -0500 (EST) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 412FD40DB3 for ; Tue, 3 Dec 2024 08:00:50 +0000 (UTC) X-FDA: 82852901334.29.A2096AA Received: from abb.hmeau.com (abb.hmeau.com [144.6.53.87]) by imf27.hostedemail.com (Postfix) with ESMTP id 948B440014 for ; Tue, 3 Dec 2024 08:00:31 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=hmeau.com header.s=formenos header.b="OjrM7Fi/"; spf=pass (imf27.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=1733212836; a=rsa-sha256; cv=none; b=C4tQKSS3UZx9nCALHNLVN6g2oLxqPorl1qv6xFm7Wg+nGuJDWPAB/9tVUWBOU6hkFJDDOM u9T7LfUtUz8Tqha0gkUlsFpo3gXa7lSVZiwdpZi3cwDTldNwzvb3GnaQnodXGMVP+PeZcx tNuclWstPgzpiAlF2MIS1Rr+2bwAJpg= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=hmeau.com header.s=formenos header.b="OjrM7Fi/"; spf=pass (imf27.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=1733212836; 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=Z5W6TzUmpOT8OeMseNLRswu8nLNRFfWLwSH5h9kFvf8=; b=42KSXhCYbITuQ/fIb5lFv+7m173nUIIR3zO7pIIo9w6ictIlre8t8vDj/EA2ptRESkQKo6 RlWoA4d46H4O3XVt9bDsEXIzSUV6dUPCAqvoXT5p6/kNs1MX7gvWKTIcDZAry1nA1VckEJ 8zT8GSeqvySZSfxkDisWwX8vXYYQybc= 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=Z5W6TzUmpOT8OeMseNLRswu8nLNRFfWLwSH5h9kFvf8=; b=OjrM7Fi/UEJfixgHY/bJ7qvuaS uRZMYNuC7UUE8nRW/QDiIfMPSbGVy5KTBnWolMExU1WQkVIfRMHIB3qbwfqMoiPBkqgivlMjeihti EFn0epR7oq9NhGUDRyxUKIEI6VL5VXd5Ujun8GjfO1rH0SFybeM/cWhgh6ZL4D6E1l5oRkKdqG724 gmoF/8tFpUmsHcQ4Fh940aCHfIlemY4UhyuY6eB3KfUEM8j5g+2qDSDhN599sY6WsmFw3TSMpaTV8 sfdZhfv1hRJYVWyV1T1at8kFyzpbeVsMUnVGQ+J32X6m9HsxTzF0hm8rVSHmPtg80pUiN7svPZ6Qx 070tpn8g==; Received: from loth.rohan.me.apana.org.au ([192.168.167.2]) by formenos.hmeau.com with smtp (Exim 4.96 #2 (Debian)) id 1tINpn-0037jd-0I; Tue, 03 Dec 2024 16:00:40 +0800 Received: by loth.rohan.me.apana.org.au (sSMTP sendmail emulation); Tue, 03 Dec 2024 16:00:39 +0800 Date: Tue, 3 Dec 2024 16:00:39 +0800 From: Herbert Xu To: "Sridhar, Kanchana P" Cc: Nhat Pham , "linux-kernel@vger.kernel.org" , "linux-mm@kvack.org" , "hannes@cmpxchg.org" , "yosryahmed@google.com" , "chengming.zhou@linux.dev" , "usamaarif642@gmail.com" , "ryan.roberts@arm.com" , "ying.huang@intel.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 v4 09/10] mm: zswap: Allocate pool batching resources if the crypto_alg supports batching. Message-ID: References: <20241123070127.332773-1-kanchana.p.sridhar@intel.com> <20241123070127.332773-10-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: 948B440014 X-Stat-Signature: hus6sby7ki9tra4xaxpk8ayqwpeeuxaf X-Rspam-User: X-Rspamd-Server: rspam09 X-HE-Tag: 1733212831-490981 X-HE-Meta: U2FsdGVkX1/wtU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683g8vutsndCX0KFGvTjZaD4YM1zxAbnFJMziP7f/x4e8Ggrodu28JtBrDHDRhZHojcC7Ga8oSx+3A41oqVdvBfa5TNg9hQbdwWp46GbZ3QIrbIPJSA82hkwZu32ScMEufT0T1rwsEkuzEVzwPpXmd+nhUe++/ci1rb/rDxZcLrK4jmnbeEEDCbVJgwHIt92Dqmj1JIx+IFRvhPuQmY5X7PpcJ/pVEKHbFH1jlt35s/zvq1nCMiuguqKx6QmRmScETpxlhk 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 Tue, Dec 03, 2024 at 12:30:30AM +0000, Sridhar, Kanchana P wrote: > > > Why do we need this "can_batch" field? IIUC, this can be determined > > from the compressor internal fields itself, no? > > > > acomp_has_async_batching(acomp); > > > > Is this just for convenience, or is this actually an expensive thing to compute? > > Thanks for your comments. This is a good question. I tried not to imply that > batching resources have been allocated for the cpu based only on what > acomp_has_async_batching() returns. It is possible that the cpu onlining > code ran into an -ENOMEM error on any particular cpu. In this case, I set > the pool->can_batch to "false", mainly for convenience, so that zswap > can be somewhat insulated from migration. I agree that this may not be > the best solution; and whether or not batching is enabled can be directly > determined just before the call to crypto_acomp_batch_compress() > based on: > > acomp_ctx->nr_reqs == SWAP_CRYPTO_BATCH_SIZE; With ahash request chaining, the idea is to accumulate as much data as you can before you provide it to the Crypto API. The API is responsible for dividing it up if the underlying driver is only able to handle one request at a time. So that would be the ideal model to use for compression as well. Provide as much data as you can and let the API handle the case where the data needs to be divided up. Cheers, -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt