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 X-Spam-Level: X-Spam-Status: No, score=-1.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 72A79C433DF for ; Fri, 26 Jun 2020 07:55:07 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 1296520768 for ; Fri, 26 Jun 2020 07:55:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1296520768 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=hisilicon.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 7BD016B0006; Fri, 26 Jun 2020 03:55:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 745ED6B0007; Fri, 26 Jun 2020 03:55:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5E6CE6B000A; Fri, 26 Jun 2020 03:55:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0146.hostedemail.com [216.40.44.146]) by kanga.kvack.org (Postfix) with ESMTP id 4087E6B0006 for ; Fri, 26 Jun 2020 03:55:06 -0400 (EDT) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id D93731EF1 for ; Fri, 26 Jun 2020 07:55:05 +0000 (UTC) X-FDA: 76970602170.29.use28_5b0728826e53 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin29.hostedemail.com (Postfix) with ESMTP id B5A5418086CDD for ; Fri, 26 Jun 2020 07:55:05 +0000 (UTC) X-HE-Tag: use28_5b0728826e53 X-Filterd-Recvd-Size: 4536 Received: from huawei.com (szxga08-in.huawei.com [45.249.212.255]) by imf07.hostedemail.com (Postfix) with ESMTP for ; Fri, 26 Jun 2020 07:55:04 +0000 (UTC) Received: from dggemi404-hub.china.huawei.com (unknown [172.30.72.57]) by Forcepoint Email with ESMTP id 4A9A0319FB231A37A57C; Fri, 26 Jun 2020 15:55:01 +0800 (CST) Received: from DGGEMI525-MBS.china.huawei.com ([169.254.6.126]) by dggemi404-hub.china.huawei.com ([10.3.17.142]) with mapi id 14.03.0487.000; Fri, 26 Jun 2020 15:54:50 +0800 From: "Song Bao Hua (Barry Song)" To: Herbert Xu CC: "akpm@linux-foundation.org" , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , Linuxarm , "Luis Claudio R . Goncalves" , Sebastian Andrzej Siewior , "David S . Miller" , "Mahipal Challa" , Seth Jennings , "Dan Streetman" , Vitaly Wool , "Wangzhou (B)" , Colin Ian King Subject: RE: [PATCH v3] mm/zswap: move to use crypto_acomp API for hardware acceleration Thread-Topic: [PATCH v3] mm/zswap: move to use crypto_acomp API for hardware acceleration Thread-Index: AQHWS4ju6iURsG9yIk+EgvuPOVc69qjp91mAgACMbEA= Date: Fri, 26 Jun 2020 07:54:49 +0000 Message-ID: References: <20200626070903.27988-1-song.bao.hua@hisilicon.com> <20200626072027.GA6153@gondor.apana.org.au> In-Reply-To: <20200626072027.GA6153@gondor.apana.org.au> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.126.200.84] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-CFilter-Loop: Reflected X-Rspamd-Queue-Id: B5A5418086CDD X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam05 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: > -----Original Message----- > From: linux-kernel-owner@vger.kernel.org > [mailto:linux-kernel-owner@vger.kernel.org] On Behalf Of Herbert Xu > Sent: Friday, June 26, 2020 7:20 PM > To: Song Bao Hua (Barry Song) > Cc: akpm@linux-foundation.org; linux-mm@kvack.org; > linux-kernel@vger.kernel.org; Linuxarm ; Luis Claudi= o > R . Goncalves ; Sebastian Andrzej Siewior > ; David S . Miller ; Mahipal > Challa ; Seth Jennings > ; Dan Streetman ; Vitaly Wool > ; Wangzhou (B) ; > Colin Ian King > Subject: Re: [PATCH v3] mm/zswap: move to use crypto_acomp API for > hardware acceleration >=20 > On Fri, Jun 26, 2020 at 07:09:03PM +1200, Barry Song wrote: > > > > + mutex_lock(&acomp_ctx->mutex); > > + > > + src =3D kmap(page); > > + dst =3D acomp_ctx->dstmem; > > + sg_init_one(&input, src, PAGE_SIZE); > > + /* zswap_dstmem is of size (PAGE_SIZE * 2). Reflect same in sg_list *= / > > + sg_init_one(&output, dst, PAGE_SIZE * 2); > > + acomp_request_set_params(acomp_ctx->req, &input, &output, > PAGE_SIZE, dlen); > > + ret =3D crypto_wait_req(crypto_acomp_compress(acomp_ctx->req), > &acomp_ctx->wait); > > + dlen =3D acomp_ctx->req->dlen; > > + kunmap(page); >=20 > Waiting on an async request like this is just silly. This defeats > the whole purpose of having a fallback. For this zswap case and for this moment, it is probably not. As for this case, there are no two parallel (de)compressions which can be d= one in parallel in a single (de)compressor instance. The original zswap code is doing all compression/decompression in atomic co= ntext. Right now, to use acomp api, the patch has moved to sleep-able context. However, compression/decompression can be done in parallel in different ins= tances of acomp, also different cpus. If we want to do multiple (de)compressions simultaneously in one acomp inst= ance by callbacks, it will ask a large changes in zswap.c not only using the new= APIs. I think we can only achieve the ideal goal step by step. >=20 > Cheers, > -- > Email: Herbert Xu > Home Page: http://gondor.apana.org.au/~herbert/ > PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt -barry