From patchwork Thu Feb 22 08:11:33 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: 13566842 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 E8C7AC48BF8 for ; Thu, 22 Feb 2024 08:11:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 54F2F6B0075; Thu, 22 Feb 2024 03:11:57 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 500096B007E; Thu, 22 Feb 2024 03:11:57 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3A0D66B0080; Thu, 22 Feb 2024 03:11:57 -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 272876B0075 for ; Thu, 22 Feb 2024 03:11:57 -0500 (EST) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id B9DAE80C00 for ; Thu, 22 Feb 2024 08:11:56 +0000 (UTC) X-FDA: 81818721432.24.1D10414 Received: from mail-oi1-f176.google.com (mail-oi1-f176.google.com [209.85.167.176]) by imf20.hostedemail.com (Postfix) with ESMTP id 276601C0009 for ; Thu, 22 Feb 2024 08:11:54 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="I0d/tJ0q"; spf=pass (imf20.hostedemail.com: domain of 21cnbao@gmail.com designates 209.85.167.176 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=1708589515; 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=Rb6F6A+ApMdDat1na/OH49cM4hajulmNpBuYW9OklqM=; b=DBwldESUMJDcjYfN+TF9BHIWwh0Cl8Fw7+SEagpL3FvoeJEBbZvRe4zpKWds2ZClN+wFzJ MSapw7zwTIhFYG+SQm+UM/NhSjpuvgaVp09b8ft8CIae54ZDokMHU/HUnpcf9OveJ/fAC2 wyUHag2kecYBq44boGqLol3tM3XBuaQ= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708589515; a=rsa-sha256; cv=none; b=QVmH5QYrZaHHTUNbuNnJD3Z2WsiR5UP6n4vo1XlsuqS58FEZuFEGAXSI5KqZOd60kxye93 s109ZDK1dyeUMm5OQjBr+hO8n2l1CVfYk4HsvNo+vMGzTvZxcrWsP8+Y8qpx87CCljtVS4 MgQJC5RNWWa0vznsJOWGYuY7MCsR8vo= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="I0d/tJ0q"; spf=pass (imf20.hostedemail.com: domain of 21cnbao@gmail.com designates 209.85.167.176 as permitted sender) smtp.mailfrom=21cnbao@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-oi1-f176.google.com with SMTP id 5614622812f47-3bba50cd318so5597906b6e.0 for ; Thu, 22 Feb 2024 00:11:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708589514; x=1709194314; 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=Rb6F6A+ApMdDat1na/OH49cM4hajulmNpBuYW9OklqM=; b=I0d/tJ0qDd+mDLi8sGrexasPpEcnjwKkYCQSY1RdLiZqDwy6uQrZE2Zy/876iQFDwM GG0bxOVE2iDwZvCI/PKMwCzHDu6jzQhmzje72v/wrNgZSlkZSZ4EMw2tA0uPd5aucARW gTMh55boDRHILGrnmZbxMp08TWM3We2XmGCVIy+pL/N3QflACEE629lvu8EGMEbJ2PN8 QIXLwXtMAkqy0qwc5x1Rao9PlBD6aRNntDmGllKzIJfwysO3y1xsD3WD7Fa0GC229kLB jUlL7RUcxInrgUPAB0sKmAmTuMNwvA0bOhZFpoGD3dH2HYHwthOrQSkxfrU1ByteuCke aKxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708589514; x=1709194314; 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=Rb6F6A+ApMdDat1na/OH49cM4hajulmNpBuYW9OklqM=; b=B+d+m95rPzsmexyeSpvGcMjLevohwrUWJkzaQECEnzfqTUsK+v/16F4NPgqaYkMAra UemQIQib/HjIs9Hg0v6rqC2boSF7MGaclSZO0l6+0OGj/ygTl+OBfa0h660+M9Ax11Ck irfKuoZGKpxklQVSiJotaQwpeKbwG/IaNONKrtwkuYYR9k0RmD2KIDcPTzhaL9Qez0wi 6T90T9jm6hhWSm8uozNe7zjtRk912KU5RCuLTMLmM9Q8DGYp+nAozXenCF94CWaEDlqT 9yPsjNrS0cJp4C+zPMIkByoNarKxTdDPbwNWydQDoMCtMhJSNsqKlIc/aatoshQMePtl CQsA== X-Forwarded-Encrypted: i=1; AJvYcCUD7mQPeM6UOXTj0ANeO4WFYgxWD8DEDnMNJBrkZCd+ZEZrkAshRl36kOBNg8qIJQ7asWLLSxfwFMJfSPXGrVxYpwM= X-Gm-Message-State: AOJu0Yz6g7jY/PEMqQd2++DEbgly+A95/1zqfEKWNQ2ShYxLm6sGFr5q ymmlWtudN9iMkvtVV2LDwCL+5FFbNq2usxmWKbTSh7ZsDzMhq7MU X-Google-Smtp-Source: AGHT+IH+iE8nn355j+obaDXw5uQfSNM7RCvZ5iPrzXuNiE225kZ5vF6pG+3rjE/Ss9UcKRo7UkW/7w== X-Received: by 2002:a05:6808:13d6:b0:3c1:4cc6:4f9b with SMTP id d22-20020a05680813d600b003c14cc64f9bmr17748546oiw.25.1708589514162; Thu, 22 Feb 2024 00:11:54 -0800 (PST) Received: from barry-desktop.hub ([2407:7000:8942:5500:3b18:a2e2:f00b:c965]) by smtp.gmail.com with ESMTPSA id du17-20020a056a002b5100b006e46672df97sm6989554pfb.75.2024.02.22.00.11.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 00:11:53 -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 v6 0/2] zswap: remove the memcpy if acomp is not sleepable Date: Thu, 22 Feb 2024 21:11:33 +1300 Message-Id: <20240222081135.173040-1-21cnbao@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Stat-Signature: yx8aa53w79my5tifqpisz7y1k45c4bi6 X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 276601C0009 X-Rspam-User: X-HE-Tag: 1708589514-269836 X-HE-Meta: U2FsdGVkX19gAvAd/DAdoJa7wTc6gcOwgkW2O09ljNP/C2mTF3oEZQY38FkkJLew4b9DQ9nWZulM4LXhyrRCYksc1usJo9cwgI9ooOJot73nPLoptasyXZEagvtuh8jeS9bCgXdvw4Jp2iU+GYHjYlFaSBbWiiSZeXWTGqKteL8gMd2pJGrOrUPUN/nTAEh7tCo+VajP9J4rl7rlNkpdt4Vm1PHXqXLecYJM0e3vfkyLEj6lNtzM2sqgjr5wvzVSOwRtjnsgPxwaDxQLRae1WZHxm+cl42PDH0mczYM6K0Oh9Gger7VgtQnJXUsTDhRZAkK+qUmsf2P5Jlrx2yDcZQaMgVXf/l3mDfILqv9966JvwxZcQS6q/nC6vg2DBEp0cZOvr1Mr4KXIzPx57uP3ZKsODavDHo5ZdVYTP3Bjw/8XTcjn+rlSaMZ6IPA0awKNDcpkSp0meSVVQO3w74xnSz0i5pyTDi3Q2xoiXas2tKF/V9KcIrEd1HGD4+1fEw8erYjSGtu3f5+BsNXzrOslmBOVb5UZb6/Spmp/gJmei/XKw1s5LehpNxj5NGAxs8El8Z08iSZajpAjZMb9L3CkO2Cf5Mkjtf8d73eBXdhZk51/Ju7/QquHHHaeBDgRflwkKD6XT47EprjjT0HyOo5PMB9UbJy//ZLfNvs95ySEUrwa3XreXBiGA4jwFLsQ7TU3beQfGuUzhChET4ur6WVn1JXmNInfJ4RKTk7OJRQpD1Ve3aRrkI6yZaS28zGaKcE+eWC3+8gbdXytkXuYvXSt40UaQLvbAJY6Tegy6M2Zvl70uHIvbbOvkGvq1pU83kKTNb4ql1TtW3bQGDVGw674bCfP7BduE7vYNEfOtA/LH4nljn3m3FA6dq8sYwRXeYO9Qb8Q1UA8LP4D6EACulO9/0+D1jWD+MtrjIFua0/JlzE267DvV1njsI+EotvR8nv5xTKInrySAi9glEVy0iD ZowXyexr 5OZ/79Wsf10iEmzads14C0agSA/cWrQevlGoEPjQAxqZIBI5fbdjinMseHosS/oYhkA7QkShQkdvI5DpQxuuPq9dMe+/Xp6yV5hYGuuNk5CWKtHA= 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 In zswap, if we use zsmalloc, we cannot sleep while we map the compressed memory, so we copy it to a temporary buffer. By knowing the alg won't sleep can help zswap to avoid the memcpy. Thus we introduce an API in crypto to expose if acomp is async, and zswap can use it to decide if it can remove copying to the tmp buffer. -v6: * add acked-by of Herbert, Thanks! * remove patch 3/3 from the series, as that one will go through crypto Barry Song (2): crypto: introduce: acomp_is_async to expose if comp drivers might sleep mm/zswap: remove the memcpy if acomp is not sleepable include/crypto/acompress.h | 6 ++++++ mm/zswap.c | 6 ++++-- 2 files changed, 10 insertions(+), 2 deletions(-) Acked-by: Johannes Weiner