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 67BA0E77188 for ; Tue, 7 Jan 2025 03:11:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CEACC6B0083; Mon, 6 Jan 2025 22:11:33 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C9A856B0089; Mon, 6 Jan 2025 22:11:33 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B61B16B008C; Mon, 6 Jan 2025 22:11:33 -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 98E6C6B0083 for ; Mon, 6 Jan 2025 22:11:33 -0500 (EST) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 508BCA04F6 for ; Tue, 7 Jan 2025 03:11:33 +0000 (UTC) X-FDA: 82979180466.14.47D27F0 Received: from mail-qv1-f44.google.com (mail-qv1-f44.google.com [209.85.219.44]) by imf08.hostedemail.com (Postfix) with ESMTP id 7D251160012 for ; Tue, 7 Jan 2025 03:11:31 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=tBJ4MrIk; spf=pass (imf08.hostedemail.com: domain of yosryahmed@google.com designates 209.85.219.44 as permitted sender) smtp.mailfrom=yosryahmed@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1736219491; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=gE5ypbffUfoAThIHdIK+6dHWsg9uuohAx51QktBl09Y=; b=s3fy/HCj6TyCu/q8aPPFdJFeN78yuyZ6H/0+A2epwHK+2Z5mwiMf+hbRwpWJwfiZUhFSzU Y8TyREgF6Wl6xPR0d/7ZrmfLNqruIeXurz+Qu+ed+WHt+RJg7MTI+Nl5uEJ4E/v+oSsp5W Exma8oiPBx6NfWgkgulpFVSpSgZ515c= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=tBJ4MrIk; spf=pass (imf08.hostedemail.com: domain of yosryahmed@google.com designates 209.85.219.44 as permitted sender) smtp.mailfrom=yosryahmed@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736219491; a=rsa-sha256; cv=none; b=DyI+Ui+HDiD2eG+XPqjq8VfJxKw59uAFOs3pThbz9VzIs2yUmBuXVGJEy/Hj0HEjIcas4z 3E+RzkDawBQeK6ttTtNe9ev5cx/Upxz3+C73KoAnBy/l9uTvL02mAYD9Jv4xa899X1JEjD nZz45bjDcS4m1kvF/ODifzK82B03+fk= Received: by mail-qv1-f44.google.com with SMTP id 6a1803df08f44-6d8fa32d3d6so91456656d6.2 for ; Mon, 06 Jan 2025 19:11:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1736219490; x=1736824290; darn=kvack.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=gE5ypbffUfoAThIHdIK+6dHWsg9uuohAx51QktBl09Y=; b=tBJ4MrIksrz7gap2+sERnIOwDv2YT2p/IiGQ1wbRg0ZKUTV0mR2gqavAiQKwr7c2tu H/yUXerzHCcnVwIjYZggtkz35Rt2TzR1Aq4EawvIOa+OFvdpFmHJfd+9bZBfjherEw+K dvLlfjdytDobttxeBjJMtpSwuUj9xrJqUtBMv8Rp/FAiTLZvCVXhxaB6gyLqVqdanRLr rpWi68AaxqAU940bsj8vG/6l5svdRldhmghT58dvrnYCJ73Ee1eoaw2exnlmxZmVWB1/ VVQTotzgKMeWXNj3NmR0bULuMui064liBEqhBNGPnY8HbPzPonhswumez1nyrYoZ338y VaVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736219490; x=1736824290; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gE5ypbffUfoAThIHdIK+6dHWsg9uuohAx51QktBl09Y=; b=tXtges1GGh4Aw6rJHcdu8UlLB4+oFYDdPe4OzwLGNYtSKRmwnMJ2gC7xLVbqpwz0UI mdCoXpxQvyBiNVaXf6lJ9TunCJJrsFm0gGFxydUFWE7WtU6WGF27ydltA0fCJSqP02Cj vWq4QR+Yo2INdgf+5bXk00DrT0mFenzheGdzzpIPmiQ7bPhtK3QsR7LuSOXsuDubNjCR hFbLrr/NwfCeWm+vgRO7T3pbYEldoAwMALG5GMiyYacXnZmxYr9PTu9Df4br2ZzKuN8A hzqnlsB4S59MAac7xDQcM1q7Dyd5iUlrI8SlSUC4zd2TRGIHLg0Fo5pwMlNtNFzT/LMI cQjQ== X-Forwarded-Encrypted: i=1; AJvYcCVVU0hDRW5ATC4kl7FfRE1LeeXgoK5tgeMFfEGO/29iR9dk3jR3h7ESi5UT3j03pMAN90vTdg2Bjw==@kvack.org X-Gm-Message-State: AOJu0YzO5jcoj7gNc/WbW/ppVuor6ECqbJCdGIuDkCRyxqWPa4hLADZ+ 6c5OW0X9uAp/AvjCBn0UsEOw3RKrnyZpNAj8SsBYtKLNgszTNqQSd4k4b8tI9rqme5vkn6t418J GZoPIP5DCz0kbbAXzNt1AS04dxJKx42OPHrP/ X-Gm-Gg: ASbGncuDpO0UjRdNLMJtladSSa/l9xta4HdLTdQgFpq00vmg5kVdj0PK7HccMIeDuJ1 i0WQSGTLDVgSL5ViCDCJX4B0uvNts8vLEZ4o= X-Google-Smtp-Source: AGHT+IFVXknZEvt8igRM3wvLzBIPpfNMtnOcFqLRi59emyfyupDg6t6qV4JZSXpUNXCDaqYAjML3enasHgO66pxFHxI= X-Received: by 2002:a05:6214:250e:b0:6d8:d5f6:8c75 with SMTP id 6a1803df08f44-6dd2334bcd5mr968244066d6.12.1736219490413; Mon, 06 Jan 2025 19:11:30 -0800 (PST) MIME-Version: 1.0 References: <20241221063119.29140-1-kanchana.p.sridhar@intel.com> <20241221063119.29140-3-kanchana.p.sridhar@intel.com> In-Reply-To: From: Yosry Ahmed Date: Mon, 6 Jan 2025 19:10:53 -0800 X-Gm-Features: AbW1kvYntz8quKXkVFcoTtGmO5nXA5-Ug3kgb4M7u5Msx8CwqjwBgpahBqKjzSU Message-ID: Subject: Re: [PATCH v5 02/12] crypto: acomp - Define new interfaces for compress/decompress batching. To: Herbert Xu 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" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 7D251160012 X-Rspamd-Server: rspam12 X-Stat-Signature: xyj3iaow4dm56au7wtw7paw4xsy7ouyk X-Rspam-User: X-HE-Tag: 1736219491-912775 X-HE-Meta: U2FsdGVkX18r32CF8mKaX12HUjMGIcSOONB9DIbcGbSz6UvkOpDXZPf7JWm06qzMO8lYplZ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/TNAlG7u1Ock6qe6N9sjaqHA3uWQgos3OaQzBIebTJhpOl2exL73Ui9/6RQ/4a42qANqWEwLdBDPA6AnDQO2tgShtoBT+YFML2uarGODaPBqbiX5im7GkN8cljodWbGsXj8= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000452, 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 6, 2025 at 6:06=E2=80=AFPM Herbert Xu wrote: > > On Mon, Jan 06, 2025 at 05:46:01PM -0800, Yosry Ahmed wrote: > > > > For software compressors, the batch size should be 1. In that > > scenario, from a zswap perspective (without going into the acomp > > implementation details please), is there a functional difference? If > > not, we can just use the request chaining API regardless of batching > > if that is what Herbert means. > > If you can supply a batch size of 8 for iaa, there is no reason > why you can't do it for software algorithms. It's the same > reason that we have GSO in the TCP stack, regardless of whether > the hardware can handle TSO. 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). With batching, we need to preallocate N PAGE_SIZE*2-sized buffers on each CPU instead. For N=3D8, we are allocating PAGE_SIZE*14 extra memory on each CPU (56 KB on x86). That cost may be acceptable with IAA hardware accelerated batching, but not for software compressors that will end up processing the batch serially anyway. Does this make sense to you or did I miss something? > > The amortisation of the segmentation cost means that it will be > a win over-all. > > Cheers, > -- > Email: Herbert Xu > Home Page: http://gondor.apana.org.au/~herbert/ > PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt >