Received: by 2002:a05:7412:98c1:b0:fa:551:50a7 with SMTP id kc1csp1907104rdb; Mon, 8 Jan 2024 14:36:43 -0800 (PST) X-Google-Smtp-Source: AGHT+IETTYmMXL41CkJ4MPlLW5slWsO596mnkcg70DkZz3kgUPFcbCXZAcNanLsVQ1GnClknSsaw X-Received: by 2002:ac8:7e90:0:b0:428:1ca6:206e with SMTP id w16-20020ac87e90000000b004281ca6206emr722974qtj.21.1704753403417; Mon, 08 Jan 2024 14:36:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704753403; cv=none; d=google.com; s=arc-20160816; b=z3hXxJXMdzanVv3sW1HNgvEfuMSHC9qUV5lD3Qo68/m5ppza7pnnaS6F0bDUPEOLsF p7+WA/zQFvkjHrqIzszvYwuN6rsQ3gJKnQ+Q/+MhXfzH+5/hoZKJJJg5hPSlhnB9VUi4 yKhoWTBO80DipI0/M+a5w04FmSPcw7BL2nkZT8rovHxyrjjo8zfu7ynyrI6+GjP3oZ+2 Okrki6MxXWe8DxHhufn6xnHa5Eqv1SQO825FfoTKIHwXLKd7juMwBVqG0lNWQVNn/w0W d7bCNz0o75y1+MbNc4bSqfGaQStiC3KHUqszAahpRVRN0Zs30ecvBQGf5fFVHClklMsI +cQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=Kp/QQnU6OqH2UQyKTVh3F3K1n7okkdJ17va/Cb7sw4E=; fh=l+cygn1PPm3qGa+e+Z3D2zZ334R4MQjWnH/dWWBdqTE=; b=vX8O8H1vX43v/NJGqaR+tdPU6TV4oSc57I3tL8Kgdy0ZX+Gnj18TWO6qIA6FUUX/mL QjBXgKTEaLKvIfSFNbzCzzAMpsYaLw6rgzZ785t35tA3KNoBJrwznp9/GHnMlC2/QFlR +GZyjv8HWirtHuJWl1pu9q5D7WqSjJqsb4y4g9K3x/dN8iddZBr1U8f3aRwK9fuW1DY1 aXT7Wys5/u+qnC/rA6x2jWZJmyCGHOTm1FkNoZHHsU6i5VJVMR1wn2gZCaYXuLrVIukB idSpEexY/ABRu80R0CRcphuFWHcf4jEZ4HdaL6DxfwttJqdi2Hv9jI6XV3cfvndc4OLO XJ/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b="h/0fEkRF"; spf=pass (google.com: domain of linux-kernel+bounces-20151-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-20151-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id u6-20020ac858c6000000b004298f2844bdsi768634qta.51.2024.01.08.14.36.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jan 2024 14:36:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-20151-linux.lists.archive=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=@google.com header.s=20230601 header.b="h/0fEkRF"; spf=pass (google.com: domain of linux-kernel+bounces-20151-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-20151-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.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 31DE31C23003 for ; Mon, 8 Jan 2024 22:36:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4182746447; Mon, 8 Jan 2024 22:36:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="h/0fEkRF" Received: from mail-ej1-f52.google.com (mail-ej1-f52.google.com [209.85.218.52]) (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 E71458468 for ; Mon, 8 Jan 2024 22:36:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Received: by mail-ej1-f52.google.com with SMTP id a640c23a62f3a-a27cd5850d6so245536966b.1 for ; Mon, 08 Jan 2024 14:36:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1704753390; x=1705358190; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=Kp/QQnU6OqH2UQyKTVh3F3K1n7okkdJ17va/Cb7sw4E=; b=h/0fEkRFtZYgTNpVIODTOOb5MyargWi+bqSh9M9HCZilmQPdJw970RAhkm2wY8NEcd 97g+qyzj6Kvp57Yw/1conm8/vqodbJmtixzVuG5zo4JKyVgtUZOcpA69XSbDpkI3VjQG A37fuAfPiSDyNC6huUb1xqACbHlZBVETuQEJ+r+iGmSLs9YUwKZS6rmetQA5Ae6jOISJ zYSG6bllS7pgFuApB+GpPiEpH0svdIQpnMWlvnzVLZ2U9vIPWoKqV0NkhFJNvl1TxMZs AzBkgAig1Z8dO6nCMEtTHAYvBKnVdZAXtUSSZlNFV/zl+7Vfpu2etwCEuAemcC5lXYPb NULw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704753390; x=1705358190; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Kp/QQnU6OqH2UQyKTVh3F3K1n7okkdJ17va/Cb7sw4E=; b=R++NM5LHjShNExroiM/+KIK0P6WZdReEsYIl6jGj+sp4McNSg2rrP+IR0r0aAEvyns yZtU2qxmvKN7IHLnqmVK/cX/VVEhMqvn0Fdp2hEUNYIU05IHg29o5yuxM2fQWdTWw10e kX+FsAf49/UFw+Ufw+lIwIJcBapDLKsu/uSzOZGaowlZcgVz+W4A6EcIZ1VZk/Uey17O 73dc/nWnvyqPFO21DIzwb2bXTUFhzrJVpxtOgHIqwwEg5TjxQCXQ5L4G1sqVZZnuPUEg zZ0kodR3idT6l7wYhlFcqi1QPJL4vVTqflSSIJKvtBlXB4O+LVGngQ081PL23aMoJv6r 2DGQ== X-Gm-Message-State: AOJu0YxXHa3knWc5BDkcbDA1xO9im68qPbqaGCYzGEamVMKj8GNF/IAj 7PnlM7HFBFLf1l2Elqc4nMpfUHVPPbHSGEFNECEBjbyRqfF5 X-Received: by 2002:a17:906:6d17:b0:a2b:1efe:fbf1 with SMTP id m23-20020a1709066d1700b00a2b1efefbf1mr59532ejr.89.1704753390154; Mon, 08 Jan 2024 14:36:30 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240103095006.608744-1-21cnbao@gmail.com> <20240103095006.608744-2-21cnbao@gmail.com> In-Reply-To: <20240103095006.608744-2-21cnbao@gmail.com> From: Yosry Ahmed Date: Mon, 8 Jan 2024 14:35:51 -0800 Message-ID: Subject: Re: [PATCH 1/3] crypto: introduce acomp_is_async to expose if a acomp has a scomp backend To: Barry Song <21cnbao@gmail.com> Cc: 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, chriscli@google.com, chrisl@kernel.org, hannes@cmpxchg.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, nphamcs@gmail.com, zhouchengming@bytedance.com, Barry Song Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Jan 3, 2024 at 1:50=E2=80=AFAM Barry Song <21cnbao@gmail.com> wrote= : > > From: Barry Song > > Almost all CPU-based compressors/decompressors are actually synchronous > though they support acomp APIs. While some hardware has hardware-based > accelerators to offload CPU's work such as hisilicon and intel/qat/, > their drivers are working in async mode. > Letting acomp's users know exactly if the acomp is really async will > help users know if the compression and decompression procedure can > sleep. > > Signed-off-by: Barry Song > Tested-by: Chengming Zhou > --- > crypto/acompress.c | 8 ++++++++ > include/crypto/acompress.h | 9 +++++++++ > 2 files changed, 17 insertions(+) > > diff --git a/crypto/acompress.c b/crypto/acompress.c > index 1c682810a484..99118e879a4a 100644 > --- a/crypto/acompress.c > +++ b/crypto/acompress.c > @@ -152,6 +152,14 @@ struct crypto_acomp *crypto_alloc_acomp_node(const c= har *alg_name, u32 type, > } > EXPORT_SYMBOL_GPL(crypto_alloc_acomp_node); > > +bool acomp_is_async(struct crypto_acomp *acomp) Is synchronous semantically the same as sleepable? IIUC synchronous code may still sleep, at least generally. The purpose of this change is to know whether we will sleep or not in the zswap code, so I suggest the code should be explicit about sleep-ability instead (e.g. acomp_is_sleepable or acomp_may_sleep).