From patchwork Fri Feb 16 04:08:12 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: 20469 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:c619:b0:108:e6aa:91d0 with SMTP id hn25csp288555dyb; Thu, 15 Feb 2024 20:17:00 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXT/CuwApEPwo2TznmG5CWhOuxUdFuEySwYGMfvrA+tUVOW4Fv5ijjlE8mjeFVKA4Z3lIrP7OKbJmCxocm4VT0vTJDuIw== X-Google-Smtp-Source: AGHT+IHJXWbpyhLOxy0rtb1bz4ZhJF6ixjJfD8QPPXzPnyNpi4YyFEiWHNlbaTSK43nGhB/lqwz/ X-Received: by 2002:a25:ab27:0:b0:dcb:c0ea:6abc with SMTP id u36-20020a25ab27000000b00dcbc0ea6abcmr3434263ybi.64.1708057020460; Thu, 15 Feb 2024 20:17:00 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708057020; cv=pass; d=google.com; s=arc-20160816; b=hUZWG+6qsXZeM3dVw9iD0AQFLMF6RTHZLYAtZiB7Pq8eNctQs7ZE9p1TQjUPrArL8M ON3HAeYPBThF1uLvM4ivIeJ5Qq/0QZH2rv3WNvebB9WTCmg84MV8D9gveWFtQY6r6Or/ WIthhcevmXyeMkmPBK1NYc16ICjOzdPuOECjzNMSOlTFz61GoelvhzUnUmtbv1nQPqmL Cy6cVDPrrKVoIDOoMqavTyAnC3PaGT23pzajaI6vwwtOd4BmCG4NeQ5XxDnhIcoS0KUj mNtHoS7u8fr0epeHXNlegUDT1xZyaqgyJQWXmLD4H9J8D597gxp5uxu6nYFU7DNjFJi+ ivpQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=9gIkxtNMiM4jWMz/QymqiYWPEEBA3/zmYvJ0m52F/Sw=; fh=Icz5gpa+WNwl3xtv8t+pDROj3kLEH09bCCnPNMxIxOI=; b=uRxmCs0wAfenJ28pEg77LfzmYoqP3+giocqk2mIMWg/dR5FAIePaFp/wpZsQqD5VxE GpffQ0TRwFZUPN92btHQL4XYsUVcOOq7UowJcCdqS4JfeH1lwnlhKpI/WrztQPf2SMfz mS0FWWpMzLAoSgSm373bIYQk7QjU8IaUOrpme42NZZlLwm1D08kN4aPiHSDWoNis5Pr2 B9QPVjyp/AAaxCzmE/tA/d00EyHzYTilYbX840qTFjuG+ZGUTi/2o9TnmM6zCchjNNQ4 VMA6u5ZJeK8zek9gZFIlDFzCXvWeCme9HQlSFjltWzDEYQcAXiMgPb/o5sbhUWNrt0Fc QZiw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=blgXYit6; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-68044-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-68044-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id b23-20020a05620a0cd700b007871f6e9e57si2988619qkj.721.2024.02.15.20.17.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 20:17:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-68044-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=blgXYit6; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-68044-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-68044-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 2BB6F1C211C0 for ; Fri, 16 Feb 2024 04:17:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C2F4114292; Fri, 16 Feb 2024 04:08:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="blgXYit6" Received: from mail-pj1-f46.google.com (mail-pj1-f46.google.com [209.85.216.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 82716134A4; Fri, 16 Feb 2024 04:08:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708056531; cv=none; b=KkOvA5LFevt6q4BnvztUUS0Dxk7pJBvfTCycymUyvVnlL/zCT+Nnd/Bvlrs87LuYvj8R4/dpeBiJTO/2VB7tMsjKNsWj1OhhafZHAVzwXV1r7JuLo7BK68x3dtJ7eFSniuguYFmZavzpGHpJ7u5UwP9t4jeDi4Ucp8rQFaDcECQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708056531; c=relaxed/simple; bh=vqVfXZrYe/yyq7Yk1lGwJ/c9MmJ5pqN2j4VN9jcJ7MQ=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=ZsVMW0TILDaL/a24yuHv054maRE/u8q62nojO9ov4KXEzbc7W8fmdFcYY5uGWzHk4/NUBGiEbQthikwdXTwvFCCrZXluhypsXaG1+uYb179oCPsD9FnxvugT4cGTD/Fc01jOXVRfZTsWFEWf2bUAaDGpFXPsG0EufcaUOcgrkFw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=blgXYit6; arc=none smtp.client-ip=209.85.216.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pj1-f46.google.com with SMTP id 98e67ed59e1d1-295c67ab2ccso1350944a91.1; Thu, 15 Feb 2024 20:08:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708056530; x=1708661330; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=9gIkxtNMiM4jWMz/QymqiYWPEEBA3/zmYvJ0m52F/Sw=; b=blgXYit6mmBEwvzVh/044cAmoIspxnStGDcwogdlUL9Nhb8O1Tdr1uoO+tWLbUZdrc EnQssfXOX0rtJlS0BdvGHPemmtkWWWiJPBDWdlay5S/boKcl9HmtCkASoIDPt8Wes2TC 5+3ZrkHs34xpwEq3EqnzIUhTsmNYMkO+QUOJwZU8cT8ePnuTLJBNJtDi4Enc9y1zxlDw /rEeTNc4vJcHYSYaKq2TXzNCpLNUQQB0+ogEuji8NRaqdCb9Wgmyx7mOaPnpKX/Y16MO BjSYl16KUMTLPgogxH2g7w2PfX0FqF+isxo6mxb4swUOJK5OsdGmDNiJEb8XcR18gNUl rNJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708056530; x=1708661330; 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=9gIkxtNMiM4jWMz/QymqiYWPEEBA3/zmYvJ0m52F/Sw=; b=MYzPtfV2UkanZDcAGlV6IaM3zRXT0yLukycqOyWM0LiPBDfsqPVxucXiqfzps6DbXp FCSxRn7K0n6cg80mnGkYdPKvqCG0dp/EVRrqbtWRVAGY5gprqAx+DpN2ZtLreV2/gPLh omlcDDp5bPCLBnBhg9icgL84E+wfOXqdhzH6dMrBwXS0QUtV5zUBn+ikyoS9yWF7yQ8I HDJ982asV5cMvA5u5DY5B5TACtUDlMkFS3yDPhOp8yfxE+TTRFwA0PEBToiDc2XYEIZS YZRoWN/Y0e/7Ws3zLHgbMAsza/KS2bkiMge3b31zNsOr2nK+fQ3rd7RTUXhv4JohqAjT uVmQ== X-Forwarded-Encrypted: i=1; AJvYcCVWVz/q9gHWFNvXZGMqzWolAY8UlvhGV0JzH78Smpt1vTmUG64NieZHUSgdVQa7WhBTgNvnjuwKqzq9nb60xW+zzDIsfIGjj5uBOa/WuhLJpG0Vkmggpor72T5ivqf0hwnsMUtORXqZCYHd X-Gm-Message-State: AOJu0YzgB94k+6PRVUDhyj8pMF5KKu/uQXTs+7OBh9MBA8sy+tDzXIBt EFq8q+tx9xi4zv8LFwg0zMymLhHN3Kjam/XxbPdq8BuOifZSKdov X-Received: by 2002:a17:90a:fe15:b0:290:9e9e:a87e with SMTP id ck21-20020a17090afe1500b002909e9ea87emr3514685pjb.42.1708056529701; Thu, 15 Feb 2024 20:08:49 -0800 (PST) Received: from barry-desktop.hub ([2407:7000:8942:5500:f28b:3925:777f:45d4]) by smtp.gmail.com with ESMTPSA id pt12-20020a17090b3d0c00b00298ff26e4c8sm2321393pjb.26.2024.02.15.20.08.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 20:08:49 -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 v2 0/3] mm/zswap & crypto/acompress: remove a couple of memcpy Date: Fri, 16 Feb 2024 17:08:12 +1300 Message-Id: <20240216040815.114202-1-21cnbao@gmail.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791027598404115006 X-GMAIL-MSGID: 1791027598404115006 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 As zswap is the direct use of this patchset and zswap benefits from this series, It is probably better for this patchset to go through Andrew's mm tree than Herbert's crypto tree if there is no objection from Herbert. -v2: * add flush_dcache_page() in scomp_acomp_comp_decomp() according to Herbert's suggestion, thanks! * collect Reviewed-by of Nhat, thanks! * rename is_async to is_sleepable according to Yosry's suggestion, thanks! Barry Song (3): crypto: introduce acomp_is_sleepable to expose if a acomp has a scomp backend mm/zswap: remove the memcpy if acomp is not sleepable crypto: scompress: remove memcpy if sg_nents is 1 crypto/acompress.c | 8 ++++++++ crypto/scompress.c | 36 +++++++++++++++++++++++++++++------- include/crypto/acompress.h | 9 +++++++++ mm/zswap.c | 6 ++++-- 4 files changed, 50 insertions(+), 9 deletions(-)