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 BBD16C10F05 for ; Thu, 7 Dec 2023 00:44:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5FE6F6B00A1; Wed, 6 Dec 2023 19:44:13 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5AEF56B00A2; Wed, 6 Dec 2023 19:44:13 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 476F36B00A3; Wed, 6 Dec 2023 19:44:13 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 3616F6B00A1 for ; Wed, 6 Dec 2023 19:44:13 -0500 (EST) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 0B1D74024C for ; Thu, 7 Dec 2023 00:44:13 +0000 (UTC) X-FDA: 81538175586.23.C15B28E Received: from mail-pj1-f45.google.com (mail-pj1-f45.google.com [209.85.216.45]) by imf10.hostedemail.com (Postfix) with ESMTP id 45E92C0012 for ; Thu, 7 Dec 2023 00:44:11 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=MKJUms1i; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf10.hostedemail.com: domain of chriscli@google.com designates 209.85.216.45 as permitted sender) smtp.mailfrom=chriscli@google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1701909851; 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=6DqbVFJwL0a1ATt96jtGqFDNW6gtbbBO5rdQ1Nc1S/s=; b=teFYY+A/sOblncYKd+PJx7jcBqzT8h2hLDhmfW5rkAZm3qddomLxQrbxaOB5ffyzF8JxEB u3GZDgouW9facZ0PV4GLsJd5l4GkFDhQYNoyVBxooB82d1zNMhRkxA/RsIt9F+bJAyjl/X QqwGiYt9QRFlKo9puW9MrEVhYeen79I= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=MKJUms1i; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf10.hostedemail.com: domain of chriscli@google.com designates 209.85.216.45 as permitted sender) smtp.mailfrom=chriscli@google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1701909851; a=rsa-sha256; cv=none; b=JOcasqud2bC3QJza66WO+aZZvnX61+JIFPmYdlhxkrzjCEE2XZC9AHiyh6zGMG3sg+jDjl JnNbxgwEhyh9wZjDXOFJtF0lgbRvh1hUdO3BELYDdLicXi+EVNUyfXY3FixGqNXeztQeMd kRAhmTjC79sy8parGlOU+Rw+3WyuVQU= Received: by mail-pj1-f45.google.com with SMTP id 98e67ed59e1d1-286b45c5a8dso420874a91.1 for ; Wed, 06 Dec 2023 16:44:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1701909850; x=1702514650; 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=6DqbVFJwL0a1ATt96jtGqFDNW6gtbbBO5rdQ1Nc1S/s=; b=MKJUms1ieDzfTXA2VL4p/mISwu7fW2ylyZqhbw/IO0x70vwq/tT9GtYHvik6VCYYLn 7jVG25jUKXVJTH6rxyRsEoksAPiV0sNFELrJwPX2YRD6NUyfIhPD9AiFlK795ziZRO8Z eIxW3am0lifW/cxl118daiPsIyklVk4nW3E6sgEuuU3+k5X0QkL6soHTADThXcD4YtkT eFHc5wEDl+yf/VpPbNYtWRIjyECJ/KhCH1Vz28wAa9HZlK4aW0EOn/XnllIzcQB2F8xW xT9Iy+TArUwYkcl13PTDblE0gGuTf7nBFq+jSLWOrvZKNdqGpOZN2vX/8nlLiwbtCUNu KLHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701909850; x=1702514650; 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=6DqbVFJwL0a1ATt96jtGqFDNW6gtbbBO5rdQ1Nc1S/s=; b=guM2ChgeV3Z34w68XXOaGrNw+KG3ckGnfa/IR0VYBqlW9gLw1ypFKjq8U6eTdf7/TB 6ZRBQf8uXWefes2pUd8S+QuEXIO1310C8UjY4KbLDod0qJPi3qibHc78eRKcDGlOFgZ7 8e0x8qF6SC56yTxHCPsREaFqvCfmLLzQNPoRopOoXtZTKOnDSmEOVhQsTSIDie3iHojA LjdHqu3ycB8JWr25vfHyBIf35HJvUW0vI6/osnZQJtOFmRjwgN+qjWafnKpesMXSpY7Q q/RlyfWNxEHhXVjqxKfmtYE2pmqfvLGh95vjSPgecfX7jWHemk69XpbcFl3bVpBPprLc W1Fg== X-Gm-Message-State: AOJu0YwKg6SfrZhPyS1/zjnThjb2Qwm+z8bMsnABQ5ZwrfvmonDzQXcz 42ZzXvKt0G6ngkMo0MeOuqR61crv5IVKDtM8rRoGUQ== X-Google-Smtp-Source: AGHT+IHbH12/27Dox62nWh31rnKZQQkO/EPVQAE4ObuI78sX9/bx8m37n7+pZtIAUV1UuCGd3+ftv5vf3lGpwqUF31M= X-Received: by 2002:a17:90b:314a:b0:286:9e2f:4755 with SMTP id ip10-20020a17090b314a00b002869e2f4755mr1715556pjb.51.1701909850021; Wed, 06 Dec 2023 16:44:10 -0800 (PST) MIME-Version: 1.0 References: <20231206-zswap-lock-optimize-v1-0-e25b059f9c3a@bytedance.com> In-Reply-To: From: Chris Li Date: Wed, 6 Dec 2023 16:43:58 -0800 Message-ID: Subject: Re: [PATCH 0/7] mm/zswap: optimize the scalability of zswap rb-tree To: Yosry Ahmed Cc: Nhat Pham , Chengming Zhou , Vitaly Wool , Johannes Weiner , Michal Hocko , Seth Jennings , Dan Streetman , Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Matthew Wilcox Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspam-User: X-Stat-Signature: mbnunkm4jgpjjme8w194pa6ccndrj9yq X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 45E92C0012 X-HE-Tag: 1701909851-915770 X-HE-Meta: U2FsdGVkX19szFxwZ3l+axJ+nZQOeyNZr2QOhe1rMQJbF+6ga8pdSxAhmklGG73VT+U/J80aCvGpf+/bCVMkeHtJxDL7ad2fv4Sf6sO721xfmtUAfEK0vZOxU7Yy8FR9aHLTAd+reBTS8lD4G8OQt+xQQbPv/VufbF+Ps6zXgFkEIejaUbFHVQgT3lewIumDsyiiC4Z2hh0xuX45IWo7Z3H8mU2mMrwWSfgWO6ecmcJppiaracD4PipDnr2X3AeI9P712HbVvflmiZ3Mp9M0NIFfUB93emB3ZbtKwloZDROQzDpPabdnMBCiywn4DWF3trqgoI0+QUw4dntnoJPuGsMEUPN1l1VT8kGSz5npJCrkA4SzW3dO7kp6EIXVK4jbY6qI3EATIqbzBCE+ZGDIwUtTNBQvFV0iTmpny/ExW10Cfc1g/8xphFfG9xJZMrUPrgjAJbjnug/umVoFjY4Ffnfc0sVZNUqTy/jwptx8jD+KLkGZ6WxtRZEEkBu9U0eUhG6ENrPhBu+U7S3p7NoCZ8TIUslx7lzH8NChu7JkTz6hBkF3KtjzupNPxzN4ha21/lth+hpHlfu3KJe6+O6R0XAXYve4XRZXv02y5ttXQfsiGI0GKDnXtddpDgG8cvrG+h9M5rNHJmXThesfiHxu9jnwOJghAoscXgvk7GEA2AzqhH4kbWCbvPlQtxDo9K9ngB87vs9+VYsbpnsrOmg1IQiC9OYQASzmkRvIONDTbM/PHnTOSBCj6cWvvlgxwa59pyZO+takCOQVe+2awMq9Sf3s3kjgvEYAhWkmUTaNJEuTqSTKDOWXnDd4vOMwdv6/foUYs0awFG+EzHx9pu7rYplvYATi7Rtoi7+23Jl3/RfE7OXQRTObQ7fEPwKL0LI/ueDgwhmliHy7nEtvav1SohTHEs8AHraDnmgvwGMVQNbWggmWZdLb8NGFz9Y6xSO8WIrpd0MMKan7NZrsIlC 5phLHalg wisRj4qMuOAFQiQQJXuPzEl7dQIEb1StEe7Ex0Q/2xsTuAexW7EESdGMuZ5Xz9zsxHRDydfMROUEu92XHZ/uTa2POrt3IMgJHqmsh5sovcpBswn94r3g0gTybViTTdEbQ7FuZXNOczP1S4ASf9iwPQQH7StjIoCZKHcN9ltOSMB65kN1s37ktfaKHXOppmqc5l4ku3gPHHrLbO/ZblVYvmBzyP5VlCJh7OlvGnTBlmrCl/Nt814OPm7qziV+1j0uJip5evVl8bbHX4bcba0lzPEHSsw== 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 Nhat and Yosry, On Wed, Dec 6, 2023 at 12:42=E2=80=AFPM Yosry Ahmed = wrote: > > On Wed, Dec 6, 2023 at 9:24=E2=80=AFAM Nhat Pham wrot= e: > > > > + Chris Li > > > > Chris, I vaguely remember from our last conversation that you have > > some concurrent efforts to use xarray here right? Yes, I do have the zswap xarray for older versions of the kernel. The recent mm-unstable tree has a lot of zswap related updates. Give me 2 days to refresh and post it. The zswap invalid entry and the reference count change is causing a good portion of the code to be updated. That is the price to pay keeping out of tree patches. My fault is not getting to it sooner. > > If I recall correctly, the xarray already reduces the lock contention > as lookups are lockless, but Chris knows more here. As you mentioned Yes. To be exact, xarray can use spin lock (same as current RB tree) or take RCU read lock on the lookup path (depending on how you call the xarray API). Not completely lockless but the RCU read lock should have less lock contention than normal spinlock. +Matthew > in a different email, it would be nice to get some data so that we can > compare different solutions. Yes, it is certainly welcome to see more data points. If I recall correctly, the zswap xarray array makes the lookup similar to the swap cache lookup. It has a noticeable difference in the long tail end. Stay tuned. Chris