From patchwork Wed Jan 3 09:50:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Barry Song <21cnbao@gmail.com> X-Patchwork-Id: 13509815 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 8F92DC3DA6E for ; Wed, 3 Jan 2024 09:50:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EB0718D005C; Wed, 3 Jan 2024 04:50:29 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E5FB08D0053; Wed, 3 Jan 2024 04:50:29 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D01288D005C; Wed, 3 Jan 2024 04:50:29 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id BDA3A8D0053 for ; Wed, 3 Jan 2024 04:50:29 -0500 (EST) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 804A4802B6 for ; Wed, 3 Jan 2024 09:50:29 +0000 (UTC) X-FDA: 81637529778.03.C4AD700 Received: from mail-oo1-f49.google.com (mail-oo1-f49.google.com [209.85.161.49]) by imf19.hostedemail.com (Postfix) with ESMTP id D1B5E1A000D for ; Wed, 3 Jan 2024 09:50:27 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="ZYgHAF/S"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf19.hostedemail.com: domain of 21cnbao@gmail.com designates 209.85.161.49 as permitted sender) smtp.mailfrom=21cnbao@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1704275427; 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-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=aEztFZJsrJ8YqCwVoGZX/9s/oSP+HNIXvJUA0ruhjFI=; b=UXOOrZpLdk4q6PkN+9BnnyeNj6lbe02cC6rE+WgDT+1phdLDyCAQ4PIqtly9qs4ZTPbwV9 tkSOOKZc8ag1tZPeA3mAf3ayppycE25asU6X+D1sL5OUGZF+hXEzJn5gBxEYwcyUu7kF0Y vdXJ1IhqZSvzZCwK/T6VTJ0QyNAWJWE= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="ZYgHAF/S"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf19.hostedemail.com: domain of 21cnbao@gmail.com designates 209.85.161.49 as permitted sender) smtp.mailfrom=21cnbao@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1704275427; a=rsa-sha256; cv=none; b=S3VbqGDW/vatzTSig6TfM2C+RxRkG9RZiiSiu97wFNaz6cIziAU9PSiWdobQ4kbghvO5fb yPZ+ZTLHOgTqUajIXWWNBaaUB0KxnNOv2AQzEwh7pjJ7YTLXoZt7Z/143S+vTX/dHD1Ybi 6JZCqRD3oY4Y3u8Erm5LySzMbNuzH0w= Received: by mail-oo1-f49.google.com with SMTP id 006d021491bc7-5942259ca62so5768676eaf.3 for ; Wed, 03 Jan 2024 01:50:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704275427; x=1704880227; darn=kvack.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=aEztFZJsrJ8YqCwVoGZX/9s/oSP+HNIXvJUA0ruhjFI=; b=ZYgHAF/SvEzIFfDpw1J7O+hEVP9tb99NB/ADWB0X5zHeFQIRIbhanse3Mh2vyVVAZE kXJ/DzugqNFIWMb+KQYX1OzdAUHGLk18XZMakA+sOKxScmay4quSTtVK9qEHfB5yDyHu m+GX9W6+t7hKNjgz6HnDATaS7NbQMxOxNf3t1jMh7b7EwgaOxgLgUAuhGYMZ/IsxMSGV Eq+1QlMcnaG2yk1Xiqteet3rwzLgiq0S8+03uKGzbxHmQUQpezwjlZQLZxv5tG9dXH90 ck39OwHO8Rsmh/yLuXO0inNJ/PTUJuAEZ5Ad6zshR3zafKZjKCCDXbhNgojWGkCICN+C sZaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704275427; x=1704880227; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=aEztFZJsrJ8YqCwVoGZX/9s/oSP+HNIXvJUA0ruhjFI=; b=XIBh8fB1/M2zUnaJsn5KqDispSgVnxS77mp7BrUaV9drRw7Bqp+rO0/JdYM8/P4YJh KJEgovClIIH1YDQw7Kh9oiuN0cYuh0MdkzH8SEV7iEfGmoiJ0UNYnk5Vm0HeQhrvP5Sb aXkLl6A7FJNDv+dEsJhBk7EwXu8udOE7/m+nN8CLGZ7gP+PtRwUQoZ2ZdCgLQl2hcvyr gLhL7Ul3wBjPqYu9Kqpel0GOAXV6M7LJazNU6psXGQd6idB85MCYgqGnKNsYKNitBhxY FK++ZmUsz9FIl5qD4U3rlwsLhN+Ngw9W0+ha0PCe9GrQoYi550pqdHYh3kf7qP7ALArx aPHQ== X-Gm-Message-State: AOJu0YwRmbvaHHtjKxafV672chXifG63X6xVwt8GftxzWmLxrs8GvLtG CeUC/0WjK5pQ3OHWHmW8EUg= X-Google-Smtp-Source: AGHT+IGJyT3iyh5T+AI2zkgdvra2Kul3OKNzrR2xwTy5aGqOVkM9d9B6vjs63GPMXB1xk6rIoOxtgQ== X-Received: by 2002:a05:6359:669a:b0:172:e402:4243 with SMTP id so26-20020a056359669a00b00172e4024243mr13698729rwb.59.1704275426915; Wed, 03 Jan 2024 01:50:26 -0800 (PST) Received: from barry-desktop.hub ([2407:7000:8942:5500:a7d6:f37a:9130:cd96]) by smtp.gmail.com with ESMTPSA id a34-20020a631a22000000b005c65e82a0cbsm21823483pga.17.2024.01.03.01.50.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jan 2024 01:50:26 -0800 (PST) From: Barry Song <21cnbao@gmail.com> To: herbert@gondor.apana.org.au, davem@davemloft.net, akpm@linux-foundation.org, ddstreet@ieee.org, sjenning@redhat.com, vitaly.wool@konsulko.com, linux-crypto@vger.kernel.org Cc: chriscli@google.com, chrisl@kernel.org, hannes@cmpxchg.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, nphamcs@gmail.com, yosryahmed@google.com, zhouchengming@bytedance.com, Barry Song Subject: [PATCH 0/3] mm/zswap & crypto/acompress: remove a couple of memcpy Date: Wed, 3 Jan 2024 22:50:03 +1300 Message-Id: <20240103095006.608744-1-21cnbao@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: b56p4oytcg8cktakyn77o4ykkp3jzdu8 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: D1B5E1A000D X-HE-Tag: 1704275427-221010 X-HE-Meta: U2FsdGVkX19O/9rkeaPfECePcmrjNgY23ksgViN22MAbGdZGUetI0n5aMhJ56Ehz7vviryOHyM+MLzEbR60dBIDlm+15idey44iDUS5VM6aAHrK3EahB0pG6vCpRrQUpuZlbHIc+TvY4aaS6g6s7zuFI57STVFXEi8T3cenzjbnYxPmaqHN/BZtUJdEitCzhUA4t5TT4R68g6VW34wjRQuggccPHUvYjSMBSC2DXQeTb+VPgV0+m+k1Mvz5UFP9um6QxXL//l9/iV4AeHbNWMTUMFr36MlfQfqXs2+p70NVBUGFjg2jirvHGvltXNWc3Of53iCj5AJ+FEGwajc2ZU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NdGMJqmj8ocG4F1mxUeu3zQG9B2KbOU8IUoEfgbjEYJcqlvWnFPS1GiYr53dt0Xk+f60bep7fWsDjJO1VtJOGpsDOYw6PzSU= 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: From: Barry Song The patchset removes a couple of memcpy in zswap and crypto to improve zswap's performance. Thanks for Chengming Zhou's test and perf data. Quote from Chengming, I just tested these three patches on my server, found improvement in the kernel build testcase on a tmpfs with zswap (lz4 + zsmalloc) enabled. mm-stable 501a06fe8e4c patched real 1m38.028s 1m32.317s user 19m11.482s 18m39.439s sys 19m26.445s 17m5.646s The patchset is based on mm-stable. Barry Song (3): crypto: introduce acomp_is_async to expose if a acomp has a scomp backend mm/zswap: remove the memcpy if acomp is not asynchronous crypto: scompress: remove memcpy if sg_nents is 1 crypto/acompress.c | 8 ++++++++ crypto/scompress.c | 35 ++++++++++++++++++++++++++++------- include/crypto/acompress.h | 9 +++++++++ mm/zswap.c | 6 ++++-- 4 files changed, 49 insertions(+), 9 deletions(-)