Received: by 2002:a05:7412:ba23:b0:fa:4c10:6cad with SMTP id jp35csp35794rdb; Wed, 17 Jan 2024 16:18:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IH7L+26pEABKv2r7LdCEZ/jl+Ke4Te3ZpfYYm/ObkC4ibKYH1sk/w3qAz8oewmhKlv9yT60 X-Received: by 2002:a05:6a00:328e:b0:6db:19dd:6ac5 with SMTP id ck14-20020a056a00328e00b006db19dd6ac5mr68806pfb.18.1705537096710; Wed, 17 Jan 2024 16:18:16 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705537096; cv=pass; d=google.com; s=arc-20160816; b=gFhVVY6XnJ9BG/U6WfT/eJHe+bPKJPYGN7npGTmZyKt+a+fkZYEBNfrafm6WF9yDAe vvTp+1TIl8S01ec6MJXgOQpSL52Eesx5UF3jVCqVWUxf9xKHhrVBeaD24R3KvW7RqL0f vFZgov8ajn1y2pDmUU9gSMVjG+pkHHx6EpNoKk4XXCPqazOF1Vt5ufkzrzfNHfm1Eb2L /c12pT65jS2JgvIlRFg16Pe+pdwuqaTjd/55r1x3BJwwlejPwTnr1FaLqQuPiZl+e65J oFTLGqcqDk3CXC2vbScpzY7HlXG5msD4V4sj63TCbjYHikZjX023ZFSn+E6S+wlWL19g d3ew== ARC-Message-Signature: i=2; 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=0kYGVAyn3+HC3vU9dioz50q03lN7IlHHqwWtJZ9UM74=; fh=o9jM6dHVkCSZXtG8mwTAzhM+Da81GC95VbCP7paW61I=; b=WfeJY4L9fS3EvPmzQ4F/ZOBMvnKcEN+sErxJFhR7yAjG8EBoCoyOW91WvF4KVISOfE OqMyHIibZ1uVXyFkHFj0wiKa2yY8wJQuZor8g0cGjxkZ9VHh+rscUgGXmaTYDbXEB963 t0JJDY3rlpGzIyppH+Va+LmBIVSVsfzM6/EsjXpJlNT1KqnuZ5enUgPSyL8pAP58nl+i lWIWGNZ0njX9kDAj0eQC0vO5/0zQqrsC/H4miVmkoqwvCd2R9YRG60619WtuqjysYOJA kHwvSLrHRkR6QAjmUlYFceJ+gpVRthMkgLGHzztSNMFx23yZd03KSZpqw567V6tfvxC9 NQxA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ACL1Qula; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-29583-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-29583-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id w3-20020aa79a03000000b006d9aaab0b5esi1966297pfj.351.2024.01.17.16.18.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jan 2024 16:18:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-29583-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ACL1Qula; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-29583-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-29583-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id CC4FCB2158E for ; Thu, 18 Jan 2024 00:18:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 91A8A39B; Thu, 18 Jan 2024 00:18:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ACL1Qula" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BF73C191 for ; Thu, 18 Jan 2024 00:18:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705537084; cv=none; b=eqOT3GexVRUk0Xiok2ECBGM6ZhBcJd5RZ2d0EM0nY7iia8bmqNVaVix9xBLf3FKp9nR6wVQszqOov57GjfchRgWead43Dc3Eo2lI704G5tWwifFePGKs+wexGfhQQBMvyMAeQAOwTIVdQDWv7MYGmmlhwhrojyQAj6z91vx1Bf8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705537084; c=relaxed/simple; bh=X8SGrIjLKz3N+7j8PpTnE7zcRdqnMOLIDx28wL64vfM=; h=Received:DKIM-Signature:Received:X-Gm-Message-State: X-Google-Smtp-Source:X-Received:MIME-Version:References: In-Reply-To:From:Date:X-Gmail-Original-Message-ID:Message-ID: Subject:To:Cc:Content-Type:Content-Transfer-Encoding; b=e0oGIjScDB5VEDO6CE6hjBQJ7X8DagpqacM+QAM2SBJtzqvMffGSdVMJw52Jn0oL9F35eqfVCybEfaUFrHi79PaJwrp0PxFKhyQgrEJzjHO9Zjje826DTd5yJprluDX+da3IFSlCNNCpR1z2VzFPbCeVKKSRIFU2QBIhTCEvWdg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ACL1Qula; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3E629C43390 for ; Thu, 18 Jan 2024 00:18:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705537084; bh=X8SGrIjLKz3N+7j8PpTnE7zcRdqnMOLIDx28wL64vfM=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=ACL1QulaRs5RMSQPqifvediFinODMrrycsn1B0ps7dyoCt0DREDn4tCsH7dFoj8eW Y74QuzpJQBkTS2ZBxS00QEUjvj87p+Gtga0BqTXCWOT5Ey9Lg5oajUYHsRpENsSud9 rzfvHcbH2Yk09ZEHk7Yxy6bN+B7OEqvEzGrFsPLXSHcIFMvddbp3tWrPcGCiBnB0lX t/8u6K812JlHy3fq0JV7D77fPr6Tc2QWF52vfsDzQoUdg43f4yV8W0E0on6UXXm0BA Ec0y14BqRukcJX/KnKwzW0Uuc3SI+6+e7DmVBhsuNyO1ivk3kPspZhJPMsXerofhyT VwOlvu/iZgMsg== Received: by mail-pl1-f176.google.com with SMTP id d9443c01a7336-1d6fbaaec91so6429405ad.3 for ; Wed, 17 Jan 2024 16:18:04 -0800 (PST) X-Gm-Message-State: AOJu0Yye79tkAKsCFq5PPssRIY8iD1L+vsdeH6Vz6XqA28444uhVCFjN oYf5if278e2ZcC/0F3IWbYzfdRIGRR5bU9vJPnuqt6WW/c9LdVH1tpNm86sHZccM+rh6uMFRqpL h908elF98UbQHlvl3NVWPFiYivFJFpoBucHdM X-Received: by 2002:a17:902:bb01:b0:1d4:cd41:e44b with SMTP id im1-20020a170902bb0100b001d4cd41e44bmr84916plb.124.1705537083735; Wed, 17 Jan 2024 16:18:03 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240117-b4-zswap-lock-optimize-v1-0-23f6effe5775@bytedance.com> In-Reply-To: From: Chris Li Date: Wed, 17 Jan 2024 16:17:51 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 0/2] mm/zswap: optimize the scalability of zswap rb-tree To: Yosry Ahmed Cc: Chengming Zhou , Andrew Morton , linux-kernel@vger.kernel.org, Johannes Weiner , linux-mm@kvack.org, Nhat Pham Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Yosry, On Wed, Jan 17, 2024 at 3:48=E2=80=AFPM Yosry Ahmed = wrote: > > > Currently the xarray patch should have everything it takes to use RCU > > read lock. However taking out the tree spinlock is more work than > > previously. If we are going to remove the tree spinlock, I think we > > should revert back to doing a zswap tree lookup and return the zswap > > entry with reference increased. The tree mapping can still decouple > > from the zswap entry reference count drop to zero. Anyway, my V1 of > > the xarray patch will not include removing the tree spinlock. > > Interesting. What do you mean by removing the tree spinlock? My > assumption was that the xarray reduces lock contention because we do > not need a lock to do lookups, but we still need the lock otherwise. > Did you have something in mind to completely remove the tree lock? In my current xarray series, it adds the xarray alongside the rb tree. Xarray has its own internal lock as well. Effectively zswap now has two locks instead of just one previously. The xarray lock will not have any contention due to the xarray lock taken inside the zswap rb tree lock. The eventual goal is reducing the two locks back to one(xarray lock), which is not in my V1 patch. Your understanding is correct, the xarray still needs to have one lock for protecting the write path. > > > The reason why I think we should wait for the xarray patch(es) is > > > there is a chance we may see less improvements from splitting the tre= e > > > if it was an xarray. If we merge this series first, there is no way t= o > > > know. > > > > > > Chris, do you intend to send the xarray patch(es) anytime soon? > > > > Thanks for the heads up. Let me send it out now. > > Awesome, thanks! I assume Chengming can test whether this series > provides the same benefits with the xarray. That would be great. The xarray patch needs more testing for sure. Chris