From patchwork Tue Feb 20 02:55:42 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: 13563284 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 CEE1BC48BF8 for ; Tue, 20 Feb 2024 02:56:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 67E186B0081; Mon, 19 Feb 2024 21:56:07 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 62E4E6B0082; Mon, 19 Feb 2024 21:56:07 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4F6716B0083; Mon, 19 Feb 2024 21:56:07 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 3D6EA6B0081 for ; Mon, 19 Feb 2024 21:56:07 -0500 (EST) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 08FAA1404A2 for ; Tue, 20 Feb 2024 02:56:07 +0000 (UTC) X-FDA: 81810667974.03.D7E08C8 Received: from mail-oi1-f177.google.com (mail-oi1-f177.google.com [209.85.167.177]) by imf09.hostedemail.com (Postfix) with ESMTP id 40FCC140005 for ; Tue, 20 Feb 2024 02:56:05 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=IilT5pne; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf09.hostedemail.com: domain of 21cnbao@gmail.com designates 209.85.167.177 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=1708397765; 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=7Ew2uLDYa+YibzlC1ysi9/XNB2ZeTVfWqOboQZAqpaQ=; b=EQ+LZ9ljxIs6SnytFzUFDvplfa0ZD6cZPCSQETwhk0NfhrmoTS+WYKVKlgk6zKo2eNDaV/ LwLbVK2UApcnSb0QzyLTVuPixmJfB9H3Rtg4KMgiXnZ7a646ykgbWevfa3SlSv3hQCHxy8 niZ8z6LZaTp5alAbS9E+SNFDTnTMYGo= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=IilT5pne; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf09.hostedemail.com: domain of 21cnbao@gmail.com designates 209.85.167.177 as permitted sender) smtp.mailfrom=21cnbao@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708397765; a=rsa-sha256; cv=none; b=HEelm764V0dgkP1O3sXcGy/5JIZeDcWaGolWqAVqZOgyV4mR+DP38uHmVqPlClSGHZm9p3 aB9zi39LnyLeiOrY+cCQF1gC9vLU5D5qzeOIsVni2j6BFdcAb5gwxoWc02VUowKsqojQc/ EW3SgFwXdALvyro7O179AM3QrJ0lrpg= Received: by mail-oi1-f177.google.com with SMTP id 5614622812f47-3c031c24fbeso4114482b6e.3 for ; Mon, 19 Feb 2024 18:56:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708397764; x=1709002564; 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=7Ew2uLDYa+YibzlC1ysi9/XNB2ZeTVfWqOboQZAqpaQ=; b=IilT5pneMk7op4WTvwWWE75kZcVRcvASNqZ0kfCCj5ra1K8hM9VJpeBSik/kdPZWkt eQLnMGaHETWXElzFSrfZQABjLU7/GDd93Uc7KhtaRxEoiL2e3GMlWyqGwsORy/Aodjck HwhbBPGMql38ojeGzFuacAg+4G2ztuTw9MfGNWlmdq9KWk93V4M/BPRCYw0RILSLlqcp ekrOoEuYDKNp57Hmn3qLPg6K3JaHK0Ky/+mbVtcHwGSRasdO3Te1L3UImC3qP4QMBRka UlODoApi9T6Y0kqJWJol+JYFDoz2qt7IxpWzAvSp4EaCEPhPUOj2xX46FC5S6yjiBldB H7MA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708397764; x=1709002564; 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=7Ew2uLDYa+YibzlC1ysi9/XNB2ZeTVfWqOboQZAqpaQ=; b=Vt0WVGdT9M3z5+aoonQFVmD+PwyJPTtBQsPfKvbD0BcbABe4aJ5Suf/QENbFkGnUD2 qeppYcQDz1HvpCtOLtFVra77qGOZ+YxtL0li7y/FqWiOBgNmzbcL9ZBVYUeHGd6AcOdb PzMKf9gd3eaSKga6km+EWQf5oCR2t3YXJS5jNlV7/TotEkjwmScOkTq/M1Hd6E31Py/K QMr4tI/M1xhD25DsogmrFPWTihixxdNDQ0T9uejj1DKpQaOepjxZsmMOoxrJ+oAUJMMY eVw0dx/ok76bePb5GY9txfkS0ZFq+R3GPPE8ZdeLkrxDvcw2DIF0OWOlXNw+R5yxTUiB k94A== X-Forwarded-Encrypted: i=1; AJvYcCVPZq/PaERph7yr1LWb+1pFje8n8QST5CbikvksXG4zAC8Bo2GakNwP+LHMQvF9KRzvOAQnIpCkRhN2FreEPCf/YRo= X-Gm-Message-State: AOJu0YwCLSoqDP2IkeW61gemUXMh8XqEXovnitpYOhr1fC3Hg+MsIZ5D MMbeAcZISunHoCGjpiSvFsWvcVsJ9yADcFNfzBBmgeBHdIdmJT9P X-Google-Smtp-Source: AGHT+IHVzDYuPtr1PDixjROU95D2WOpMV8YqDATlijBv/laOgNSF6wkze5o4QPBD98zajktdx5oSsw== X-Received: by 2002:a05:6808:1642:b0:3c0:4d21:e62a with SMTP id az2-20020a056808164200b003c04d21e62amr17385554oib.31.1708397764271; Mon, 19 Feb 2024 18:56:04 -0800 (PST) Received: from barry-desktop.hub ([2407:7000:8942:5500:a5bd:9c11:af2b:aecf]) by smtp.gmail.com with ESMTPSA id j34-20020a63fc22000000b005dc1edf7371sm5500047pgi.9.2024.02.19.18.55.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Feb 2024 18:56:03 -0800 (PST) From: Barry Song <21cnbao@gmail.com> To: akpm@linux-foundation.org, davem@davemloft.net, hannes@cmpxchg.org, herbert@gondor.apana.org.au, linux-crypto@vger.kernel.org, linux-mm@kvack.org, nphamcs@gmail.com, yosryahmed@google.com, zhouchengming@bytedance.com Cc: chriscli@google.com, chrisl@kernel.org, ddstreet@ieee.org, linux-kernel@vger.kernel.org, sjenning@redhat.com, vitaly.wool@konsulko.com, Barry Song Subject: [PATCH v4 0/3] mm/zswap & crypto/compress: remove a couple of memcpy Date: Tue, 20 Feb 2024 15:55:42 +1300 Message-Id: <20240220025545.194886-1-21cnbao@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Rspamd-Queue-Id: 40FCC140005 X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: ctc6wmzke1nt4u1x33e1n8uc6s88es4w X-HE-Tag: 1708397765-621916 X-HE-Meta: U2FsdGVkX1+bnfB15epp+r9ZlHUCLJn4fDWARGJRoWx4/hanEwE54JWYNwVQJSDAJkD7QVJjmosggLSILrExREyC+40CfdRFgYAbCtTNMwi+yGLx5jvYVTCONvl4JXSHw2sQyeZrBy9AR3WRTDvjHbJfeA0npzP4aT+xKvrteDZfdJIsDMgstPQaWT+NEZ00NOGtwdw9iRxEBqcjGez7heRbPwJCWs4yUZ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tKEohCyb7VMxCsdb0A203ik+DviALR4U4uZmN0ZElNelbSmtTZAIhXfVsCRRYRvCkVsoUNlQlaP06GGHygsV1EpsuftgjuHztYt0cqLxQwXCT+OxvVlRAz55SJRdetOptWcAeF5tGJlJA0HS2OOQPC5lCYIYzK/qHpuWRHvzNtVaEbsbtul1uANwx4YKCDKyY/PrSprqeHQksnxfBJUqYqBX9rCiuUPfVEQLOw== 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 This patchset applies to mm-unstable as recently zswap has lots of change. -v4: * introduce a helper for algorithm flags according to Herbert * fix cra_flags for intel and hisilicon async drivers Barry Song (3): crypto: introduce crypto_acomp_get_alg_flags to expose algorithm flags mm/zswap: remove the memcpy if acomp is not sleepable crypto: scompress: remove memcpy if sg_nents is 1 crypto/scompress.c | 36 +++++++++++++++++----- drivers/crypto/hisilicon/zip/zip_crypto.c | 1 + drivers/crypto/intel/iaa/iaa_crypto_main.c | 1 + include/crypto/acompress.h | 5 +++ include/linux/crypto.h | 5 +++ mm/zswap.c | 7 +++-- 6 files changed, 46 insertions(+), 9 deletions(-)