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 315BFCD11DF for ; Tue, 26 Mar 2024 21:21:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B2F736B0099; Tue, 26 Mar 2024 17:21:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AE0056B009B; Tue, 26 Mar 2024 17:21:19 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9A7C66B009C; Tue, 26 Mar 2024 17:21:19 -0400 (EDT) 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 879296B0099 for ; Tue, 26 Mar 2024 17:21:19 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 595C9A077F for ; Tue, 26 Mar 2024 21:21:19 +0000 (UTC) X-FDA: 81940461078.06.3AFCE37 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf22.hostedemail.com (Postfix) with ESMTP id C7CD1C0002 for ; Tue, 26 Mar 2024 21:21:16 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=lrU18sWF; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf22.hostedemail.com: domain of chrisl@kernel.org designates 145.40.73.55 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=1711488077; 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=f3X+p2cQIXLunY4fM/FACVTNTQlPnKBSCpuObEa286Y=; b=vyoKRBUdBmbS1/UgzLqUWFW6vcR97VOj1BxcsriwJpRGltAL0orksC1ZMMPcmX689cCIkV A/8njsyx3npPQ+BvvRTA2Nh9zOy5bxO3MXzIaffGDVjjHkgImTjEJ7fydn3mxXu/KFjRNj rjVop2Jp8qbuKvMN9lyrmJX7Nl5idso= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=lrU18sWF; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf22.hostedemail.com: domain of chrisl@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=chrisl@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1711488077; a=rsa-sha256; cv=none; b=Buqr4CB6EL/yKRqTboRSDVBWVlxqodABZDFvrb6VFjA5HdqA/0Ky+g8dNp8XshVSnBzqfL 64n+q7HGwhOn7E5fctH/TPAaeH8EzsdsGjZ6V/Lu1cDVacwajVa9KFe9kdSLydp/qZI40k Yv6hZwv9QJ7HaQtmstUxugTsG/H9ktE= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id E647DCE2437 for ; Tue, 26 Mar 2024 21:21:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F08FFC433B1 for ; Tue, 26 Mar 2024 21:21:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711488071; bh=ktBOuN/l0Oqul05K8wPsro6WSmUcfgpQoRmRKkgldYg=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=lrU18sWF1ETGrnm9UxISdDAayt9qCwAKD7/Xl1FGv2ql5Omy93G4SViRcwXYgjo6x nLi+j+4dKuDxqub6MnEw98o1ujl9i0rjMOMJRSVULOIoIh4alPzfw4K+lmDmlTB4+T gMWFMAUAExDkkfr/8/M/ciAbcmnvm+xOg2vDjvTHE9AkniRj5a6lLaO8NnzQUnFJ01 yIYkn4+zwwqMff7fCW186SKAtB9hw63FY2oy6n97H/EHyrXSfcBgAqJu/09ZDsFx7/ Wmw9o1NJpA3IHvXxv4CI7RxIhzra35/Cxa4jxbIHHNjPyTeB1mfL/2WodfVYApbF0O BOTZi3ZBN3oLw== Received: by mail-lf1-f49.google.com with SMTP id 2adb3069b0e04-5159f9de7fbso4503533e87.1 for ; Tue, 26 Mar 2024 14:21:10 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCUE0aMOcIX5zaMNtxKJsEgdzHEqw7eo2FXgqE489Hxw18qwnWHTs8MBbJFlwVf7OMuf2E0K6TUZJLQPAg4yRKIl5GU= X-Gm-Message-State: AOJu0YxmOiasYbOx1X/0YZXTIX1K7+xgRh+Sq3O1e1iinXJ4ctRLTaFU fInAUnAAXriFiKiBebH9kz1DnNWAwfFSSOqy0t5DX9cSwIeuLmmS5hpvnZVhcyTYql8d566dkBr Hmzu4Tco6k9ylKx03JCcwEGJnWQ== X-Google-Smtp-Source: AGHT+IG3wPYvGie/m4nkqFnR7BNbZ+T1nPhZdmhz95gFdDCYjSNPOfiAniuep2UkhdyYu4tSSvF/Ll1U2Y302My7IiE= X-Received: by 2002:a19:5e58:0:b0:513:ccbe:d79f with SMTP id z24-20020a195e58000000b00513ccbed79fmr519276lfi.8.1711488069574; Tue, 26 Mar 2024 14:21:09 -0700 (PDT) MIME-Version: 1.0 References: <20240326-zswap-xarray-v9-1-d2891a65dfc7@kernel.org> In-Reply-To: From: Chris Li Date: Tue, 26 Mar 2024 14:20:58 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v9] zswap: replace RB tree with xarray To: Nhat Pham Cc: Andrew Morton , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Yosry Ahmed , Johannes Weiner , "Matthew Wilcox (Oracle)" , Chengming Zhou , Barry Song Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: C7CD1C0002 X-Stat-Signature: sg7nrhry1yi114tmjtubm4o5qhinq1j6 X-HE-Tag: 1711488076-57986 X-HE-Meta: U2FsdGVkX18yg7EsDMXU7wAuvO2mVZL45lX76RVqKMf/rBf1/idO+dPIkcWN+loK6DX+RgMuV7gfS57Eo+t9NsYdpHQLNu9z4xj1FVL0sUNu6nY1q8sZrTvDcCbUI8WFV+o0d1b6gtNuAoEv358n6PWYeZQiiatHfZ0CSEyGStc/YLCjbpGBDJtOUlVU7T/Swe1W6vKLYaerfwcryk9aRvzeaJMXSl2RRqbgy/OE4uZO6m22p/3vA2cajR+ZHDqluqlSak0/UAHnSR42+eF3gAR/SFQSEAGtklpcLdRfwDvoyk01RWWV5IuBX01Cy/Ci6L1sjNyHb3oUH/rub1mbBQTGsSQwaOMwiuApBMGh8AICJRadze7vdzDLjzXf3J4Nva1RFnzO+/MX4F8u9loNVR1IrQmmQbIxct5pRVnzsTYDglpgwpOZu6zncoA8erl+fsyGpTVTlVnolGbA+pqNZEDivqcM4f75LFBEkXg3ywurKMcjibml5Wy3L+K6JLw1mtde5IbT6tRt+7veIdwEDL5F1JwO93qs+w0lUu0418Qj/luiotsQF2eS2M2fCqkLa396JtCGiylhhoJVAp+PlHmYUEeCMSP1QYE+FrNp4iLo7lCPGt7IeYse2VuCo+t2hX6G7wllj9IrbPwDqewriajahgESVZjB61raQcruzLOHqvTGPFGLdK3v29BjoyZ1JE2GJnsgvE5vMUhVq/hAutiWNTmrZH+4GMWg1IhvbyjsDbPLSQeZV6H6LHQMDb3aA32LSE9ETy4e0sORVXRnTCAo6LFiw2ZWNISoC9VO8v1nMHNSOdtLdvXLEmhpritB+p3/hUDsNoKAzKOfYhYqTNmht4OcYv6f3iVAy7N8os5sbkEw+1t9CSGKiy5zibQK69OplWWiNc2E5UHWdp2Iwbt83+Nowzwc4bzOTFLYZ0cxetygKVyf9o7kZLMeZKl6UPVGWaezBxaQnaRfkcM baMJr6xs J9yR71GpbBZEAGDXYyboWxfiOtwmdsT2HRIoe2FnCjVPkY8VzvVWsCoFWWYERpU3HNqXmCbeMVQ+4xkxBSfCOA4CTYYBVTQxGaGv/suGnQfg4jUChD9iPHzoiMduiEvSSfLGVhJU7Aavu53I33lWY9/kZfRWd/vzaF4kFDSydqdbgpuzqbw78E0FQTJu4SrcmxIeuyXog5lj+xpuD4oM5PKkvchUQMteGIGWJQ+t6QAF/0AtluwZvBEejc/YJLjKyuVREe4oZkrPj8VD5mRNsDkT86YlSrvdeu1Srm6IpCuXiTxo= 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, Johannes and Nhat, Thank you for your review. I have sent out V10 to revert the comment. Chris On Tue, Mar 26, 2024 at 2:04=E2=80=AFPM Nhat Pham wrote= : > > On Tue, Mar 26, 2024 at 11:42=E2=80=AFAM Chris Li wro= te: > > > > > - * When reading into the swapcache, invalidate our entry. The > > > + * When reading into the swapcache, erase our entry. The > > > * swapcache can be the authoritative owner of the page and > > > * its mappings, and the pressure that results from having tw= o > > > * in-memory copies outweighs any benefits of caching the > > > @@ -1649,8 +1581,12 @@ bool zswap_load(struct folio *folio) > > > * the fault fails. We remain the primary owner of the entry.= ) > > > */ > > > if (swapcache) > > > - zswap_rb_erase(&tree->rbroot, entry); > > > - spin_unlock(&tree->lock); > > > + entry =3D xa_erase(tree, offset); > > > + else > > > + entry =3D xa_load(tree, offset); > > > > This is the place I make the modification for the conflict resolution. > > It depends on the swapcache to execute xa_erase() or xa_load(). > > Obviously, the xa_load() will not delete the entry from the tree. > > > > The conflict resolution itself LGTM. I'll let you and Johannes decide > on the comment (but FWIW, the original meaning still holds, so I don't > see why we need to fix it). > > Reviewed-by: Nhat Pham >