From patchwork Tue Feb 20 06:44:11 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: 13563465 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 A1EECC48BC4 for ; Tue, 20 Feb 2024 06:44:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 387186B008A; Tue, 20 Feb 2024 01:44:36 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 30FBE6B008C; Tue, 20 Feb 2024 01:44:36 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 18A736B0092; Tue, 20 Feb 2024 01:44:36 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 034AD6B008A for ; Tue, 20 Feb 2024 01:44:36 -0500 (EST) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id C805A1A0567 for ; Tue, 20 Feb 2024 06:44:35 +0000 (UTC) X-FDA: 81811243710.11.7331B52 Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) by imf22.hostedemail.com (Postfix) with ESMTP id 1254DC0007 for ; Tue, 20 Feb 2024 06:44:33 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=jiXhyYai; spf=pass (imf22.hostedemail.com: domain of 21cnbao@gmail.com designates 209.85.214.180 as permitted sender) smtp.mailfrom=21cnbao@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1708411474; 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=i2aL+tHLY0VW/P/ruhh4nglplL/Lhxc/gUkBRs4GoYc=; b=jMi5PJPj3nBl0/LAd4DOexnds+vm80ps5aBCX7620UaFIN2E+D+OaYXX1QanCwlyxIVXI9 hyA0Xh2VvYXl6IHtxelcngnKNtbyE858XiWx76HdmUt6tPtrIZDqVyKnEfjoGxiX1lNavk v1bOb+ot9XLNoATvzpLa59268+9Gc44= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708411474; a=rsa-sha256; cv=none; b=YOtf879TZHToXiU4nKvIEgzNw8qq9Ugse3aSgc7jFCJFX3+DpozagzQM6bKf7lpk1B9aFq 9xjKcpvInozjIS79Dv/y837uDSEOhfzaBo0P74lWJrvzi7cWkw7fNa8ZnoMVanGpR4/UcJ 7yUqlueZzPTgaQF0oc3RQiq4ucmk7LE= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=jiXhyYai; spf=pass (imf22.hostedemail.com: domain of 21cnbao@gmail.com designates 209.85.214.180 as permitted sender) smtp.mailfrom=21cnbao@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-1d7431e702dso49736365ad.1 for ; Mon, 19 Feb 2024 22:44:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708411473; x=1709016273; 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=i2aL+tHLY0VW/P/ruhh4nglplL/Lhxc/gUkBRs4GoYc=; b=jiXhyYaiNWjC4cjZvvckdhtlWVC5yedKpTiNEjh2hOHrjqkyXPrDe4e3j62+sAiue7 5QxrRR4oM8J+Eti4BfGbWSjYO91lS5HoqDMmQiQjVZX4LU7YVN4m1t7fdZBEzvJxczIu fdpz1JeuLaQSRnsI0hze/16fVuN3qbZFWZbO6qWfS5gFKtDhIN1CWRbn5S1cILXk28vV 6Z0Rze55gEyp5iFbDHWB3Xldm/amuVplfUkRTeOdqh93wU33WUlYDbqDeWN8vaZNoSym Gvs7Glzovg3eAoDxicrQoF+w8V6b8PjlTuxnWTamSKE8g5zgg8jpt+VhEu7BoRGABSTT BJDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708411473; x=1709016273; 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=i2aL+tHLY0VW/P/ruhh4nglplL/Lhxc/gUkBRs4GoYc=; b=jTxLcKI3JBQlrTqFGvxsRTEnVGBrsINzL4pupj/DxZp0MEKq15XB/7YRfuZJIXGyFQ umW/DbHUFOG4LSuFYXVSRRyFL6ff1uD5QBBQjTs4XbSrmkfBb2Wrcv5Lr9fVH37OsWpT yBhejuQrfCpuaw19pcsYtBsDDWRRpe25oWK9iziTLboq57dwh+cEpplFEh3j5tzTqYpF BYtZQp0s/nIeL4hIpNkily/MEjGDLyDHj+aTewb22ih7s5Utub3XVN7sytt+AalhlYUn gMFA56zf7u2JGLxsOrluGrI2UOsjAl3n9olEDOXO415auTn2VsQMrXvD04AbioogxH2z TkKw== X-Forwarded-Encrypted: i=1; AJvYcCXvdHrYBVBElyoHs+12h0n5Eoz83TTyXot0yqdVulO2Ar85jsG4NBtDGGR2gcB+0DjD90herg7vKHBbXOTI/i8pIFc= X-Gm-Message-State: AOJu0YyWh2kbTyMmueptASiUyzWC5rVPIWWGjCo8X/kPt0DVV1cHA0fr fWWpWGI4rygkZAvbM94Q4c40Dgeyuq1nsyd3eHXJ+w2a0NtJ8X3v X-Google-Smtp-Source: AGHT+IEitGa7GaedpJW3RDJe4mFVNHXIAb5Z1qrfL/aDfUYmWhkNQLmwyuspBkLd6MZ1/Npg0zW5sw== X-Received: by 2002:a17:902:c402:b0:1db:3a22:1fd6 with SMTP id k2-20020a170902c40200b001db3a221fd6mr15979321plk.66.1708411472707; Mon, 19 Feb 2024 22:44:32 -0800 (PST) Received: from barry-desktop.hub ([2407:7000:8942:5500:a5bd:9c11:af2b:aecf]) by smtp.gmail.com with ESMTPSA id w16-20020a1709029a9000b001db60446abdsm5419090plp.262.2024.02.19.22.44.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Feb 2024 22:44:32 -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 v5 0/3] mm/zswap & crypto/compress: remove a couple of memcpy Date: Tue, 20 Feb 2024 19:44:11 +1300 Message-Id: <20240220064414.262582-1-21cnbao@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Rspamd-Queue-Id: 1254DC0007 X-Rspam-User: X-Stat-Signature: a6uoume97r7c63pik61ngqynau49e3te X-Rspamd-Server: rspam03 X-HE-Tag: 1708411473-199745 X-HE-Meta: U2FsdGVkX19VcpWXcsPuJaV6pggN8UDSFCNjsPD+5LBJ94HIgh5aYyKw683MdNeVTVMEAGMFym6CuX8Ngp7XGqafYzlIzTvI4eTFB0P1JmVAlF7tot8EeTea+IAlz7cqltQxklUkoLA+SWDDc1b+0V7lqwUFBe7/p12waxymimSJdAqs9w01weRy6mgxC4/wdZ+ufFRBvDbtcGB9ub3XnvumJrPd5D/+JvH6jUTz5V5BCAHTKZ4AM3pRW7K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YEwAtTr5wTQtHNsIH84/xrzprxBaUNSZxld1OmB493CdzZmt0xbodbyg/qF5uYf1pC+F25nZY8JrPrG72wIYe5xcX4giZMq9wwk1RtLhIpm1IUCyCPM0/O5krK0t/9AY2tWYO46N4OWs9vggGZd8bxaiTsBgxbe0w2Cj6OyGnyOJYHi3qmNd3N3VI+jahPhPqBjIfixPnKVaQqnK0Y2EITC/cPYyWKcsbM= 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. -v5: * remove the helper of exposing algorithm flags, alternative directly expose acomp_is_async() by test ASYNC flag according to Herbert; * remove the fixes of cra_flags for intel and hisilicon async drivers, they are separated patches[1] according to Herbert [1] https://lore.kernel.org/linux-crypto/20240220044222.197614-1-v-songbaohua@oppo.com/ Barry Song (3): crypto: introduce: acomp_is_async to expose if comp drivers might sleep mm/zswap: remove the memcpy if acomp is not sleepable crypto: scompress: remove memcpy if sg_nents is 1 crypto/scompress.c | 36 +++++++++++++++++++++++++++++------- include/crypto/acompress.h | 6 ++++++ mm/zswap.c | 6 ++++-- 3 files changed, 39 insertions(+), 9 deletions(-)