From mboxrd@z Thu Jan 1 00:00:00 1970 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 503D0D2E001 for ; Wed, 23 Oct 2024 00:52:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D56C66B00A5; Tue, 22 Oct 2024 20:52:32 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D07286B00AE; Tue, 22 Oct 2024 20:52:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BA95F6B00AF; Tue, 22 Oct 2024 20:52:32 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 95F366B00A5 for ; Tue, 22 Oct 2024 20:52:32 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 2FDEC16063F for ; Wed, 23 Oct 2024 00:52:13 +0000 (UTC) X-FDA: 82703040252.20.20505C2 Received: from mail-ej1-f47.google.com (mail-ej1-f47.google.com [209.85.218.47]) by imf27.hostedemail.com (Postfix) with ESMTP id B38664000B for ; Wed, 23 Oct 2024 00:52:13 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=QNlsiMwI; spf=pass (imf27.hostedemail.com: domain of yosryahmed@google.com designates 209.85.218.47 as permitted sender) smtp.mailfrom=yosryahmed@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1729644549; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=hRIYo0vfi/WbTNWFN/Rxuhp7/0FV171BLNc1zvZJ4gI=; b=G0QjO957je4MuUUZOK1oh7tckkMq2D4bNl0wPd8OzWLGN/el8le23BbcirQbl8xnLavSmY RH6bEVH+oWNj7bSNX5eWe4SHUFxvWPpKqNHW+ud+x2XleXDwTHExXoTSs2A5jcwNnnT3Za c2EGABThqyLLOfGi6178ZAsfDAQkEYg= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=QNlsiMwI; spf=pass (imf27.hostedemail.com: domain of yosryahmed@google.com designates 209.85.218.47 as permitted sender) smtp.mailfrom=yosryahmed@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1729644549; a=rsa-sha256; cv=none; b=jn4BgL4fawYgA9rqd/XzTolUQFWIS63NxL9V3H7DqJwa5TwB4qSxQANIp8i2aaj82SRHdM 19hWfJDwPWKisXn4up0RXDNJMAr83GPudx5TMXzBnsVE02W9cLCMWCzC/Z0n/spPrZ75cp 3REwVHoL/dTwywaizWb+JmwG7VGOMOg= Received: by mail-ej1-f47.google.com with SMTP id a640c23a62f3a-a9a0cee600aso779400566b.1 for ; Tue, 22 Oct 2024 17:52:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1729644749; x=1730249549; darn=kvack.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=hRIYo0vfi/WbTNWFN/Rxuhp7/0FV171BLNc1zvZJ4gI=; b=QNlsiMwIIiu2y8Hl04+OEU/N13xQgZ0M68rguxf9FsBmIBCEWibVAmcHjlUteUbGc5 IQgUd+Om4PVaJ4VYQOrJc3sf2wKw7Ebg53n+hxwjVL5nQfIx/d6rzsfvdXxsH/ZR77J5 zMZElknGhhRylsQ16QTuI5j1oJ6qGjlvBYhB3Grekx5NzVGez7kJeWHIUIQJVq6MS5BO RXKKY5y5bZ3MGBbrNAMUM3sirgWa6V5wiregOfxjIAMZdCcgxgHkHpcLG/Lo+23xlQIG Y2L1w49QXJ/L9QWer5J5a1sgeI9WqVpwtyjCTZRDOqwPsopWAoHx7mYELWUvVmhrXU8D zAyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729644749; x=1730249549; 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=hRIYo0vfi/WbTNWFN/Rxuhp7/0FV171BLNc1zvZJ4gI=; b=RXEwH/aD8fKcD8FUeza4JIsYQPSBVLlpI26zy4RITKZ3Tzd0h2ralpUOKZcvC4xzA6 rZJw/xvNwH1noBdYKpqQGjY+pVxnTsl2ghQ1g4f8MECx6hQX7CTGfN9C0OBRs/W6HXrr SkypaTMP4nf+pTLkUw2qrpHPIyPPULfql2iTR5eDeePjhQELYW1hIc5jGLLzF+1vhkRi YUM35iYbY1UYv8OAqAPPMgFIYsPN9SR2mksjBZbyklDubRgEiCq63zDNp5VvlY5Tx1La O4XPKZYHGeLssYXR1LMMhzJc0h4A7uF1ZU39tw2eK+fIm0Ewi8hhyUIufXOZgSb83jHl Wl1Q== X-Forwarded-Encrypted: i=1; AJvYcCUiYGgQODWR7UOo6oBcuzK2CNBnAU9MlvuWXhsP1Yjk4UzZEMqiftZcDhoZdspkhjLk1TZM9nXP6g==@kvack.org X-Gm-Message-State: AOJu0YysBKXRXYi+qjvRa8ZverTL2vgS4kXK6lAQ6n0EBOeSfDVn2gSu sbIyUEkjPcaLhiQlmMkTpsaKoCUfrG2JpOrH/WQueaSsgdrUN1UaqTFsSfomPfkzzWwpzzh6raz eyr1UNOc2lGXolqSgrh/305cySU1WauN9BXUhKomSjROVsvQUTA== X-Google-Smtp-Source: AGHT+IGaSuqXB7IIAkW6V33L0/YI5ddbxQfQQvy9XmGu9/QvRowihI63d3sdCC7W9vU1fxOSJOB31qFe99DHuA4HBaA= X-Received: by 2002:a17:907:3e0a:b0:a9a:6ab:c93b with SMTP id a640c23a62f3a-a9abf9b5984mr62235166b.62.1729644748622; Tue, 22 Oct 2024 17:52:28 -0700 (PDT) MIME-Version: 1.0 References: <20241018064101.336232-1-kanchana.p.sridhar@intel.com> <20241018064101.336232-11-kanchana.p.sridhar@intel.com> In-Reply-To: <20241018064101.336232-11-kanchana.p.sridhar@intel.com> From: Yosry Ahmed Date: Tue, 22 Oct 2024 17:51:52 -0700 Message-ID: Subject: Re: [RFC PATCH v1 10/13] mm: zswap: Create multiple reqs/buffers in crypto_acomp_ctx if platform has IAA. To: Kanchana P Sridhar Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, hannes@cmpxchg.org, nphamcs@gmail.com, chengming.zhou@linux.dev, usamaarif642@gmail.com, ryan.roberts@arm.com, ying.huang@intel.com, 21cnbao@gmail.com, akpm@linux-foundation.org, linux-crypto@vger.kernel.org, herbert@gondor.apana.org.au, davem@davemloft.net, clabbe@baylibre.com, ardb@kernel.org, ebiggers@google.com, surenb@google.com, kristen.c.accardi@intel.com, zanussi@kernel.org, viro@zeniv.linux.org.uk, brauner@kernel.org, jack@suse.cz, mcgrof@kernel.org, kees@kernel.org, joel.granados@kernel.org, bfoster@redhat.com, willy@infradead.org, linux-fsdevel@vger.kernel.org, wajdi.k.feghali@intel.com, vinodh.gopal@intel.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: B38664000B X-Stat-Signature: jdq7u611smmir7c1mc1fif1hbmxnztoo X-Rspam-User: X-HE-Tag: 1729644733-54499 X-HE-Meta: U2FsdGVkX19tN/xDa6sEVPgs9np2FDQL9w/xmEDzyH9Dzzh+npaVORLP6CZVjjJ/xe7hwkUiQkZ/KZIlWngf/RswCRudixE9vbFKN1ihaM/Wr5FX/Tm9fkdlJH0P+5to0Y22yCvTUanwJyJdQiLycng6VeWmruqRH5haAFVt+TC2csUnWTlTk4Mj/XOfj35d/UN6Nl1o/KGiBcoCnw5bUU6czxlNuOuEnBsWXac1gzMevFsryjWozIFnp4T4lmaXJqtp4pW9IHRERXbp/yztcCONMPCmrmzw6LB0kwhBLqEw+mDYSl64NClnkarsTHj7IQN5mqSFiZ9JTZK486NBK1UCdiUidwz2zFMr9ZHuUkTwO/wp+wGbkopIXmxjNjN5GPR9euHhLURhxcje9xXIW196aARoea7RXUqb+T2tpl9QAorP9tGmy9KBjh/QVhalN35GdEfM8gBafGM3TEVq3gG4PvuRBhxkRkvFr964ELfNH6SzHJ43tYaKZiP0ZCc8Sr0wTRPiQa2NG1TFV58vQiVQl7gL5aLhH1x6scX1XI8t+hB2gPgoimBodwqhwYKOP+cS+YX0wrUqlPeOgjbnS9XIcdXw4DOEj2Ohr94vMwBNGNeEpKOMbBa+N9GgRYbliRpR75kLMjVGi3ZurtiHd3Eka+DPtALIURr4jFYUZH66liakRntMpO0gFIZQ12SPQMA6310nZ4FY16sHCbBZgUzWT1JzJWd8oShGHC80QnYAN/86r3nKdH7PXgY0o1t821kYv3UgKzd1lK9w6g0ULR1IiRcI2O83FS4ZqUGqZqlx88IRYxRpXZq39dPj7YfuXj2otarNTnZMekXqqILQjB3Mlp3M9X9u4rjgFDAtOFJIGr7U71JSJut5bjH5rlzxeBls7NMLY+c33FsuT6Ec5oRuC2xBpsd3IgYG8EmM8q4r5wR7lXFZfi6g/R+Q+LYCSRi0ibvooEd3e9f7ExM 66mnNP/A f3E/qUWvGYcsZBoYHCPlUpyaTV3UaHC+eB+mJ2z95k3IYK1STSBM1xmiTiheEfYXLRw3+NgvHaq2s4zRf3Bjp373zxYJ4d4WbDJghSB6ASclPbHJiUg80IeS0TnAVNlIukvlOztin58SlJVFvPGTXl8r7h+cA22mmxUm+mtyJWwYwrONzebiD8BlNWJj0JEamk6HW4HdsKlZnlvGwL8aKLAD9M5gA0xC0tW8vcrQoEGZF/eLYq1KEPRgOnqbXuH4hu0Y7NZQX+fWO9wQ= 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: On Thu, Oct 17, 2024 at 11:41=E2=80=AFPM Kanchana P Sridhar wrote: > > Intel IAA hardware acceleration can be used effectively to improve the > zswap_store() performance of large folios by batching multiple pages in a > folio to be compressed in parallel by IAA. Hence, to build compress batch= ing > of zswap large folio stores using IAA, we need to be able to submit a bat= ch > of compress jobs from zswap to the hardware to compress in parallel if th= e > iaa_crypto "async" mode is used. > > The IAA compress batching paradigm works as follows: > > 1) Submit N crypto_acomp_compress() jobs using N requests. > 2) Use the iaa_crypto driver async poll() method to check for the jobs > to complete. > 3) There are no ordering constraints implied by submission, hence we > could loop through the requests and process any job that has > completed. > 4) This would repeat until all jobs have completed with success/error > status. > > To facilitate this, we need to provide for multiple acomp_reqs in > "struct crypto_acomp_ctx", each representing a distinct compress > job. Likewise, there needs to be a distinct destination buffer > corresponding to each acomp_req. > > If CONFIG_ZSWAP_STORE_BATCHING_ENABLED is enabled, this patch will set th= e > SWAP_CRYPTO_SUB_BATCH_SIZE constant to 8UL. This implies each per-cpu > crypto_acomp_ctx associated with the zswap_pool can submit up to 8 > acomp_reqs at a time to accomplish parallel compressions. > > If IAA is not present and/or CONFIG_ZSWAP_STORE_BATCHING_ENABLED is not > set, SWAP_CRYPTO_SUB_BATCH_SIZE will be set to 1UL. > > On an Intel Sapphire Rapids server, each socket has 4 IAA, each of which > has 2 compress engines and 8 decompress engines. Experiments modeling a > contended system with say 72 processes running under a cgroup with a fixe= d > memory-limit, have shown that there is a significant performance > improvement with dispatching compress jobs from all cores to all the > IAA devices on the socket. Hence, SWAP_CRYPTO_SUB_BATCH_SIZE is set to > 8 to maximize compression throughput if IAA is available. > > The definition of "struct crypto_acomp_ctx" is modified to make the > req/buffer be arrays of size SWAP_CRYPTO_SUB_BATCH_SIZE. Thus, the > added memory footprint cost of this per-cpu structure for batching is > incurred only for platforms that have Intel IAA. > > Suggested-by: Ying Huang > Signed-off-by: Kanchana P Sridhar Does this really need to be done in zswap? Why can't zswap submit a single compression request with the supported number of pages, and have the driver handle it as it sees fit? > --- > mm/swap.h | 11 ++++++ > mm/zswap.c | 104 ++++++++++++++++++++++++++++++++++------------------- > 2 files changed, 78 insertions(+), 37 deletions(-) > > diff --git a/mm/swap.h b/mm/swap.h > index ad2f121de970..566616c971d4 100644 > --- a/mm/swap.h > +++ b/mm/swap.h > @@ -8,6 +8,17 @@ struct mempolicy; > #include /* for swp_offset */ > #include /* for bio_end_io_t */ > > +/* > + * For IAA compression batching: > + * Maximum number of IAA acomp compress requests that will be processed > + * in a sub-batch. > + */ > +#if defined(CONFIG_ZSWAP_STORE_BATCHING_ENABLED) > +#define SWAP_CRYPTO_SUB_BATCH_SIZE 8UL > +#else > +#define SWAP_CRYPTO_SUB_BATCH_SIZE 1UL > +#endif > + > /* linux/mm/page_io.c */ > int sio_pool_init(void); > struct swap_iocb; > diff --git a/mm/zswap.c b/mm/zswap.c > index 4893302d8c34..579869d1bdf6 100644 > --- a/mm/zswap.c > +++ b/mm/zswap.c > @@ -152,9 +152,9 @@ bool zswap_never_enabled(void) > > struct crypto_acomp_ctx { > struct crypto_acomp *acomp; > - struct acomp_req *req; > + struct acomp_req *req[SWAP_CRYPTO_SUB_BATCH_SIZE]; > + u8 *buffer[SWAP_CRYPTO_SUB_BATCH_SIZE]; > struct crypto_wait wait; > - u8 *buffer; > struct mutex mutex; > bool is_sleepable; > }; > @@ -832,49 +832,64 @@ static int zswap_cpu_comp_prepare(unsigned int cpu,= struct hlist_node *node) > struct zswap_pool *pool =3D hlist_entry(node, struct zswap_pool, = node); > struct crypto_acomp_ctx *acomp_ctx =3D per_cpu_ptr(pool->acomp_ct= x, cpu); > struct crypto_acomp *acomp; > - struct acomp_req *req; > int ret; > + int i, j; > > mutex_init(&acomp_ctx->mutex); > > - acomp_ctx->buffer =3D kmalloc_node(PAGE_SIZE * 2, GFP_KERNEL, cpu= _to_node(cpu)); > - if (!acomp_ctx->buffer) > - return -ENOMEM; > - > acomp =3D crypto_alloc_acomp_node(pool->tfm_name, 0, 0, cpu_to_no= de(cpu)); > if (IS_ERR(acomp)) { > pr_err("could not alloc crypto acomp %s : %ld\n", > pool->tfm_name, PTR_ERR(acomp)); > - ret =3D PTR_ERR(acomp); > - goto acomp_fail; > + return PTR_ERR(acomp); > } > acomp_ctx->acomp =3D acomp; > acomp_ctx->is_sleepable =3D acomp_is_async(acomp); > > - req =3D acomp_request_alloc(acomp_ctx->acomp); > - if (!req) { > - pr_err("could not alloc crypto acomp_request %s\n", > - pool->tfm_name); > - ret =3D -ENOMEM; > - goto req_fail; > + for (i =3D 0; i < SWAP_CRYPTO_SUB_BATCH_SIZE; ++i) { > + acomp_ctx->buffer[i] =3D kmalloc_node(PAGE_SIZE * 2, > + GFP_KERNEL, cpu_to_node(c= pu)); > + if (!acomp_ctx->buffer[i]) { > + for (j =3D 0; j < i; ++j) > + kfree(acomp_ctx->buffer[j]); > + ret =3D -ENOMEM; > + goto buf_fail; > + } > + } > + > + for (i =3D 0; i < SWAP_CRYPTO_SUB_BATCH_SIZE; ++i) { > + acomp_ctx->req[i] =3D acomp_request_alloc(acomp_ctx->acom= p); > + if (!acomp_ctx->req[i]) { > + pr_err("could not alloc crypto acomp_request req[= %d] %s\n", > + i, pool->tfm_name); > + for (j =3D 0; j < i; ++j) > + acomp_request_free(acomp_ctx->req[j]); > + ret =3D -ENOMEM; > + goto req_fail; > + } > } > - acomp_ctx->req =3D req; > > + /* > + * The crypto_wait is used only in fully synchronous, i.e., with = scomp > + * or non-poll mode of acomp, hence there is only one "wait" per > + * acomp_ctx, with callback set to req[0]. > + */ > crypto_init_wait(&acomp_ctx->wait); > /* > * if the backend of acomp is async zip, crypto_req_done() will w= akeup > * crypto_wait_req(); if the backend of acomp is scomp, the callb= ack > * won't be called, crypto_wait_req() will return without blockin= g. > */ > - acomp_request_set_callback(req, CRYPTO_TFM_REQ_MAY_BACKLOG, > + acomp_request_set_callback(acomp_ctx->req[0], CRYPTO_TFM_REQ_MAY_= BACKLOG, > crypto_req_done, &acomp_ctx->wait); > > return 0; > > req_fail: > + for (i =3D 0; i < SWAP_CRYPTO_SUB_BATCH_SIZE; ++i) > + kfree(acomp_ctx->buffer[i]); > +buf_fail: > crypto_free_acomp(acomp_ctx->acomp); > -acomp_fail: > - kfree(acomp_ctx->buffer); > return ret; > } > > @@ -884,11 +899,17 @@ static int zswap_cpu_comp_dead(unsigned int cpu, st= ruct hlist_node *node) > struct crypto_acomp_ctx *acomp_ctx =3D per_cpu_ptr(pool->acomp_ct= x, cpu); > > if (!IS_ERR_OR_NULL(acomp_ctx)) { > - if (!IS_ERR_OR_NULL(acomp_ctx->req)) > - acomp_request_free(acomp_ctx->req); > + int i; > + > + for (i =3D 0; i < SWAP_CRYPTO_SUB_BATCH_SIZE; ++i) > + if (!IS_ERR_OR_NULL(acomp_ctx->req[i])) > + acomp_request_free(acomp_ctx->req[i]); > + > + for (i =3D 0; i < SWAP_CRYPTO_SUB_BATCH_SIZE; ++i) > + kfree(acomp_ctx->buffer[i]); > + > if (!IS_ERR_OR_NULL(acomp_ctx->acomp)) > crypto_free_acomp(acomp_ctx->acomp); > - kfree(acomp_ctx->buffer); > } > > return 0; > @@ -911,7 +932,7 @@ static bool zswap_compress(struct page *page, struct = zswap_entry *entry, > > mutex_lock(&acomp_ctx->mutex); > > - dst =3D acomp_ctx->buffer; > + dst =3D acomp_ctx->buffer[0]; > sg_init_table(&input, 1); > sg_set_page(&input, page, PAGE_SIZE, 0); > > @@ -921,7 +942,7 @@ static bool zswap_compress(struct page *page, struct = zswap_entry *entry, > * giving the dst buffer with enough length to avoid buffer overf= low. > */ > sg_init_one(&output, dst, PAGE_SIZE * 2); > - acomp_request_set_params(acomp_ctx->req, &input, &output, PAGE_SI= ZE, dlen); > + acomp_request_set_params(acomp_ctx->req[0], &input, &output, PAGE= _SIZE, dlen); > > /* > * If the crypto_acomp provides an asynchronous poll() interface, > @@ -940,19 +961,20 @@ static bool zswap_compress(struct page *page, struc= t zswap_entry *entry, > * parallel. > */ > if (acomp_ctx->acomp->poll) { > - comp_ret =3D crypto_acomp_compress(acomp_ctx->req); > + comp_ret =3D crypto_acomp_compress(acomp_ctx->req[0]); > if (comp_ret =3D=3D -EINPROGRESS) { > do { > - comp_ret =3D crypto_acomp_poll(acomp_ctx-= >req); > + comp_ret =3D crypto_acomp_poll(acomp_ctx-= >req[0]); > if (comp_ret && comp_ret !=3D -EAGAIN) > break; > } while (comp_ret); > } > } else { > - comp_ret =3D crypto_wait_req(crypto_acomp_compress(acomp_= ctx->req), &acomp_ctx->wait); > + comp_ret =3D crypto_wait_req(crypto_acomp_compress(acomp_= ctx->req[0]), > + &acomp_ctx->wait); > } > > - dlen =3D acomp_ctx->req->dlen; > + dlen =3D acomp_ctx->req[0]->dlen; > if (comp_ret) > goto unlock; > > @@ -1006,31 +1028,39 @@ static void zswap_decompress(struct zswap_entry *= entry, struct folio *folio) > */ > if ((acomp_ctx->is_sleepable && !zpool_can_sleep_mapped(zpool)) |= | > !virt_addr_valid(src)) { > - memcpy(acomp_ctx->buffer, src, entry->length); > - src =3D acomp_ctx->buffer; > + memcpy(acomp_ctx->buffer[0], src, entry->length); > + src =3D acomp_ctx->buffer[0]; > zpool_unmap_handle(zpool, entry->handle); > } > > sg_init_one(&input, src, entry->length); > sg_init_table(&output, 1); > sg_set_folio(&output, folio, PAGE_SIZE, 0); > - acomp_request_set_params(acomp_ctx->req, &input, &output, entry->= length, PAGE_SIZE); > + acomp_request_set_params(acomp_ctx->req[0], &input, &output, > + entry->length, PAGE_SIZE); > if (acomp_ctx->acomp->poll) { > - ret =3D crypto_acomp_decompress(acomp_ctx->req); > + ret =3D crypto_acomp_decompress(acomp_ctx->req[0]); > if (ret =3D=3D -EINPROGRESS) { > do { > - ret =3D crypto_acomp_poll(acomp_ctx->req)= ; > + ret =3D crypto_acomp_poll(acomp_ctx->req[= 0]); > BUG_ON(ret && ret !=3D -EAGAIN); > } while (ret); > } > } else { > - BUG_ON(crypto_wait_req(crypto_acomp_decompress(acomp_ctx-= >req), &acomp_ctx->wait)); > + BUG_ON(crypto_wait_req(crypto_acomp_decompress(acomp_ctx-= >req[0]), > + &acomp_ctx->wait)); > } > - BUG_ON(acomp_ctx->req->dlen !=3D PAGE_SIZE); > - mutex_unlock(&acomp_ctx->mutex); > + BUG_ON(acomp_ctx->req[0]->dlen !=3D PAGE_SIZE); > > - if (src !=3D acomp_ctx->buffer) > + if (src !=3D acomp_ctx->buffer[0]) > zpool_unmap_handle(zpool, entry->handle); > + > + /* > + * It is safer to unlock the mutex after the check for > + * "src !=3D acomp_ctx->buffer[0]" so that the value of "src" > + * does not change. > + */ > + mutex_unlock(&acomp_ctx->mutex); > } > > /********************************* > -- > 2.27.0 >