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 41033C41535 for ; Tue, 19 Dec 2023 22:49:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C259D8D0005; Tue, 19 Dec 2023 17:49:16 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id BD54A8D0003; Tue, 19 Dec 2023 17:49:16 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A9D118D0005; Tue, 19 Dec 2023 17:49:16 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 9DD0B8D0003 for ; Tue, 19 Dec 2023 17:49:16 -0500 (EST) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 679BDC046A for ; Tue, 19 Dec 2023 22:49:16 +0000 (UTC) X-FDA: 81585060312.20.459E423 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf04.hostedemail.com (Postfix) with ESMTP id 5299D40038 for ; Tue, 19 Dec 2023 22:49:13 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=aMF8V40e; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf04.hostedemail.com: domain of chrisl@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=chrisl@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1703026153; a=rsa-sha256; cv=none; b=epnCWBo5bVTQNuSRJs8Eb8/gsPvPW9/32HFj2Ul63i/so845rQSpFQzztUXNIiR3w3/FnP 0gMCO+mh86VF1EZwU/LHYBdC3gb+bDZUuO+NwM+Nb5L4BaQ56t4UBHCJYqjUc13jNtkG0H tL54AyUCr1YGo4AKo+OeJolIrrw6z6g= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=aMF8V40e; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf04.hostedemail.com: domain of chrisl@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=chrisl@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1703026153; 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=1X3iQ1H4qyK/kqDM7P36GVGbqwLhGqwbysyjdbQ3qRU=; b=jo1rgeEAzMDC4Evyxfu+uS6rW9oOMfNeWNNSEGRGMT3acuGW8rV4CH1+c4XfK0/sd5WU9E LARVwUwifpZaYQsiSBZSXbduRRx5rhp0NNaP1q7CoF9pF2OC0A2b4TvC7XRHvtbHzNPMlD umtXmCHw+gO1wKTcYv9U/xECVi4r7Sk= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by ams.source.kernel.org (Postfix) with ESMTP id A103FB81AE1 for ; Tue, 19 Dec 2023 22:49:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BC986C433C9 for ; Tue, 19 Dec 2023 22:49:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1703026150; bh=EleRH5HdD7HIdp95MU4VpkTGtYuJwIDY/CqwNuAntrw=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=aMF8V40evMM3565e/M/7whPJcX5jDXmToks6Ms/6VawdbyTO4/ZpdzyM9hIhAsESE SNQkGatc3IHEJkgrc+/itvGxe3qrhRqoOS1Vp9SO8SSHRKEHSCRcHCn6e0DXnWURL5 aJCvAVKh5uihpxX++DghnqCOCXohr/0XtQUySkSPf03/XGLdrzZq/czqMG/v6GvpFV LXkMs3sZopcpPnS62ElB5sX+oepwgyZ17bZJolz8EGJI4v1I3ByawcbGJpYMRj+Yr+ Usf8EnpZsp5FkEMFqZpGkrL4cgrNK2OByWgugTqhacyvNgUed3uz0zFUCkYk9+2Vcr Fltzv++asfFtA== Received: by mail-io1-f50.google.com with SMTP id ca18e2360f4ac-7b7fdde8b56so21044839f.1 for ; Tue, 19 Dec 2023 14:49:10 -0800 (PST) X-Gm-Message-State: AOJu0Yyw9yM7tFNORnZN+gTWgvkcHib+8VsR7SCujifl44RlLcRBlI+Q VnMr9/zG6pYXNiqoGCO4E0mzOfqWjojPmoMZ8UL9NA== X-Google-Smtp-Source: AGHT+IFAwras/5q0VvOZUk9UWGY3+BY3/wKRh1L8JwZ6ASI4z5GFzZVJNrivwyeVzgt8VVbE/bURl/p4KonsjXLC/aw= X-Received: by 2002:a92:cd8d:0:b0:35f:b86c:cd27 with SMTP id r13-20020a92cd8d000000b0035fb86ccd27mr3009702ilb.0.1703026150019; Tue, 19 Dec 2023 14:49:10 -0800 (PST) MIME-Version: 1.0 References: <20231213-zswap-dstmem-v3-0-4eac09b94ece@bytedance.com> <20231213-zswap-dstmem-v3-6-4eac09b94ece@bytedance.com> In-Reply-To: From: Chris Li Date: Tue, 19 Dec 2023 14:48:58 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v3 6/6] mm/zswap: directly use percpu mutex and buffer in load/store To: Yosry Ahmed Cc: Nhat Pham , Chengming Zhou , Seth Jennings , Vitaly Wool , Dan Streetman , Johannes Weiner , Andrew Morton , linux-kernel@vger.kernel.org, linux-mm@kvack.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 5299D40038 X-Stat-Signature: osqs7rcgaeh4d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8Mz1heWG77ZeLHHrLx5Qb/HYRCrjjl/oLVWNovX3ePQs6qGHdf2E+VWEsTNejQt+7SoqfhZutbVMKVe5C8BzYS5e15T8M9gIHgNEoz+QbqYa4nIBNpX0OCdiu33WZGXzggs2EONghHVCZWPEGTW6v8O0GclWI0lwewFLgv6PoOd8pr71MW/2j9BF4P1yo7GHY= 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: Hi Yosry, On Tue, Dec 19, 2023 at 1:39=E2=80=AFPM Yosry Ahmed = wrote: > > My main concern is that the struct name is specific for the crypto > acomp stuff, but that buffer and mutex are not. > How about we keep it in the struct, but refactor the struct as follows: If it is the naming of the struct you are not happy about. We can change the naming. > > struct zswap_ctx { > struct { > struct crypto_acomp *acomp; > struct acomp_req *req; > struct crypto_wait wait; > } acomp_ctx; > u8 *dstmem; > struct mutex *mutex; > }; The compression and decompression requires the buffer and mutex. The mutex is not used other than compress and decompress, right? In my mind, they are fine staying in the struct. I am not sure adding an level acomp_ctx provides anything. It makes access structure members deeper. If you care about separating out the crypto acomp, how about just remove acomp_ctx and make it an anonymous structure. struct zswap_comp_ctx { struct /* cryto acomp context */ { struct crypto_acomp *acomp; struct acomp_req *req; struct crypto_wait wait; }; u8 *dstmem; struct mutex *mutex; }; Then we remove other per_cpu_load as well. I also think the original struct name is fine, we don't need to change the struct name. The value/code_change ratio for renaming the struct alone is low. On the other hand, if we can get rid of some per cpu load, that value is high enough to justify the patch. Chris