Received: by 2002:a05:7412:ba23:b0:fa:4c10:6cad with SMTP id jp35csp514667rdb; Thu, 18 Jan 2024 10:01:57 -0800 (PST) X-Google-Smtp-Source: AGHT+IHMlKPDgXiFSrMmCWo1n1pXhzOyhbaw17zbZOQImxmiixhd1kCtvcvWyEa+RHgJP31kzg0g X-Received: by 2002:a05:6512:2251:b0:50e:aa46:7572 with SMTP id i17-20020a056512225100b0050eaa467572mr13706lfu.58.1705600917626; Thu, 18 Jan 2024 10:01:57 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705600917; cv=pass; d=google.com; s=arc-20160816; b=KezgE19yy1ioOfbM0NU16zwXwJWYEdYbP3t9SFz39TDf6PZkP1vtAYeX1l2krU+029 ZrD3DH96HoKUgFkxca9OuWBcM5wAv/S0iNfXCPAwXFLjDDf7ptyEQ1dgPFaDMXJ/n3rj SpdU5//Aj9B4DXN65E9g+mQHmxEkczG5qW1dp71avRhs5Ps8nBShFOx4L0SgVZ/l72uY 1sYFOSFFdOwHFSTKDzfv+leO3qMSKW++Jb1NwtXU6aoAa+xPY6bxsTNk63Lh8ATAqP6m ZV52rJt7pxFejX1zedl3FG28/aXgyyyneFA016AJ/a14YxkX7SX/T6GheWjNwogThcvu D+Ww== 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=gql2dWnZ2ERl3+pU3WuNWOTW7xdtLV2bCUv96eyfuAk=; fh=gubGstDx6ylVjLOavc1xMq6uO+H1ZjKW9WDGV2D6B0U=; b=ZP/FPfXc/u4Xd5LbWxbcC9oFL9F+a7+IhSfv5b24GL97BGmr5PU8ObfN2njfPBmSKi bwU5xl5iOeiwgIC/4YhBj69ZFGQWYC1kiHQs+xk8DjOTUYwWVYYW9i1jGNqsm0/94FEq E5mKlbVgWxM9qQcT60rKrOfyEAWklAQKoIBoARreCB2vHegbLLTWUhc873n0BEw88ZUo oun2XFgmjunSpYe618nbsgk+g3n3lEzDyUQHWmSfQQ8im94mwkYmG08qCw0FVf5hY0dZ lng8Psl/SD4VYJE2gLyfJWP/bz3+uBwYHfdV7mrjPgwawCOLmiZJcFfTg4Z2jo3s8i2e DyzQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=JK6bXBKq; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-30453-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-30453-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id jx24-20020a170906ca5800b00a2cfe9dd275si5619040ejb.440.2024.01.18.10.01.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Jan 2024 10:01:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-30453-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=JK6bXBKq; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-30453-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-30453-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 5F0FD1F284A3 for ; Thu, 18 Jan 2024 18:01:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7F1D32D616; Thu, 18 Jan 2024 18:01:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="JK6bXBKq" Received: from mail-io1-f46.google.com (mail-io1-f46.google.com [209.85.166.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6C0ED2D609 for ; Thu, 18 Jan 2024 18:01:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705600894; cv=none; b=bgw12XS8LWqslvw1uwxJ5gzBCqH9vWEPcWsf+pNNSdzFgJHkWUUoe3AOh3JV1rFop3OuCQ/aryZvSuuhpp+UkH9Be4sj3EHvY06RvPOuAkgyN2exnmOjyrrgPaKG7OqBNCLpTBSnyFgtyzRvZKm7evREEO0jiRaA8NQS+UnHydY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705600894; c=relaxed/simple; bh=uqEn4FO9fz2oMQ6KrNER0vp9V3traJzwrSg/mntc0uM=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=GyksV3H0IbQT3Qbb7kSN6iedlN5xOvXmVpGG4Jl41F22p01FqUiwEr/piuMuYA3pVSL9jpp3ITclhFeYGeTtbpb3EIqsj0vZyFcwMxwjGVdH0LndND30bAmcLfhMmeUKhOiskH0/aba+GzJVtf/7iWwJ9ik1/0qqS+Owp6nuA8M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=JK6bXBKq; arc=none smtp.client-ip=209.85.166.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-io1-f46.google.com with SMTP id ca18e2360f4ac-7bee8858a8aso302171639f.0 for ; Thu, 18 Jan 2024 10:01:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705600892; x=1706205692; darn=vger.kernel.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=gql2dWnZ2ERl3+pU3WuNWOTW7xdtLV2bCUv96eyfuAk=; b=JK6bXBKqdTYdYgXA29cmhnhPGadtw1zH9oopNgSkALilZAzzAX1u1jq146IJnZHs2k Nq9QX8Upoj9NbEoHiZDG9Il7aor3ZDzdjFMTwLScJM0bdUBdW+jzlCIV1df0S67TkjUD 2oT+AMxnYys2KD8UlblAhxkm2jMJ2dSwBXhwqQT4WUBr+W6qlIkJHHnIM3WRELIkrtN5 N9CdJevYfAqNKJXHp9Amx/xXZJvIV/WBe4ltyCylJAPNcJp96E0LHDWHxwtpbq+Ldn3d SIKYJHqGIiLZS0FITxp2iQUQp75jfjy2zpRdzSugm15Wu/LUItCkf5hcZkbyBk30qBKw YOoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705600892; x=1706205692; 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=gql2dWnZ2ERl3+pU3WuNWOTW7xdtLV2bCUv96eyfuAk=; b=UJlUy9nHgScw+sj0g1WmjlfVFlLA291odpY6IcNCOPDjX14pY6MhI8YgBOyWSQO9fD /RFiIBBAazGXxkRAf0uTaYdD2WrB7T4rax/MHhCRH5hzdQF2WNpxTVJOeS3ezffRm/Ib KwlmMlBjHfg7A4tfhON5utu7g1WWABMP6AE6xEdr/niimHmk2Gk7ZDA2UTYtnzGC04Hk XeJMWWovExMUwxwxIMT7YsjzWLroY7AUeH/b/zspCGoIAIVdO2HhFIxiNgehgKkyMQoZ Ken6ZbovPwd0ago5G1wWUAY7pVtd2YlHKdeqS+rKsLMrV+0+HvJONLNpZIRWQgaMa2j2 WzDA== X-Gm-Message-State: AOJu0YwVat+BvYzwZMXXLfdMenILNFuK/+z4Hf6AhHug9EJN67ogqB1B CsxfCHTTfE8A0CmV+OYxGRRnj8FnarEZlwdkV/LBXiLHFRcyRnFPF9Wklw3AOG7N0adtGWX21Ty qR2NCUCrxWAvpmljZn6cwZezO4JI= X-Received: by 2002:a6b:c8d8:0:b0:7bf:42d7:f4b with SMTP id y207-20020a6bc8d8000000b007bf42d70f4bmr1321080iof.6.1705600892417; Thu, 18 Jan 2024 10:01:32 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240117-zswap-xarray-v1-0-6daa86c08fae@kernel.org> In-Reply-To: <20240117-zswap-xarray-v1-0-6daa86c08fae@kernel.org> From: Nhat Pham Date: Thu, 18 Jan 2024 10:01:21 -0800 Message-ID: Subject: Re: [PATCH 0/2] RFC: zswap tree use xarray instead of RB tree To: Chris Li Cc: Andrew Morton , linux-kernel@vger.kernel.org, linux-mm@kvack.org, =?UTF-8?B?V2VpIFh177+8?= , Yu Zhao , Greg Thelen , Chun-Tse Shao , =?UTF-8?Q?Suren_Baghdasaryan=EF=BF=BC?= , Yosry Ahmed , Brain Geffon , Minchan Kim , Michal Hocko , Mel Gorman , Huang Ying , Johannes Weiner , Kairui Song , Zhongkun He , Kemeng Shi , Barry Song , "Matthew Wilcox (Oracle)" , "Liam R. Howlett" , Joel Fernandes , Chengming Zhou Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Jan 17, 2024 at 7:06=E2=80=AFPM Chris Li wrote: > > The RB tree shows some contribution to the swap fault > long tail latency due to two factors: > 1) RB tree requires re-balance from time to time. > 2) The zswap RB tree has a tree level spin lock protecting > the tree access. > > The swap cache is using xarray. The break down the swap > cache access does not have the similar long time as zswap > RB tree. > > Moving the zswap entry to xarray enable read side > take read RCU lock only. > > The first patch adds the xarray alongside the RB tree. > There is some debug check asserting the xarray agrees with > the RB tree results. > > The second patch removes the zwap RB tree. > > I expect to merge the zswap rb tree spin lock with the xarray > lock in the follow up changes. > > I can surely use some help in reviewing and testing. > > Signed-off-by: Chris Li > --- > Chris Li (2): > mm: zswap.c: add xarray tree to zswap While I think it is pretty neat to keep the rbtree around to check if the results agree during development stages, in the final version please squash the patches. One patch is enough :) > mm: zswap.c: remove RB tree > > mm/zswap.c | 120 ++++++++++++++++++++++++++++++-------------------------= ------ > 1 file changed, 59 insertions(+), 61 deletions(-) > --- > base-commit: d7ba3d7c3bf13e2faf419cce9e9bdfc3a1a50905 > change-id: 20240104-zswap-xarray-716260e541e3 > > Best regards, > -- > Chris Li >