Received: by 2002:a05:7412:ba23:b0:fa:4c10:6cad with SMTP id jp35csp786512rdb; Thu, 18 Jan 2024 21:14:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IEGw9WMa7x85ohQmf7XxZG3Ger3iUfzEXgcTGKS7bLN+D0L5HsJrfzNcbrnDsEeT52V6rhS X-Received: by 2002:a17:906:aeda:b0:a2c:4c47:319 with SMTP id me26-20020a170906aeda00b00a2c4c470319mr695549ejb.89.1705641276514; Thu, 18 Jan 2024 21:14:36 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705641276; cv=pass; d=google.com; s=arc-20160816; b=kxILezx0hVTTRYA+b7JyQjrsM5thM+SOPlcQIgY+FZZwYI/11C+Lel4XMMD094gjSk aHFkDCYbqw0sD7Jied8Iuwnpui6cJc//cc6+T9GGzxU88kNw5LwRV593PTqubbiKbJII ms2Em/f8JUbK1dgVV57v3B2frV0v1GiJRUTmbDeO1cCiWlRbXtFqlc1eqhrPG2s0QyHz pH/xLMJauUzkfhWhcZ5+iT6aRXAE2Mfleu73LFC7ClamRwzbcNqKt+/8oo6TL6dAQVyx iVZFvi8OBA+x2aXrCWGuF4lLVgXAWEE5JQIRew6SSJCSvzvu7P/w/TG4XuYSPqNm1aSl z3Cw== 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=wp3wjd4I+zVM5cxe6a7l/i+C674LfaWl8nrY3usedYE=; fh=GKodlSICuoiDOxvQnhx6MONezXsHbSEgYL9ILJiwWNY=; b=JZWv2wjVefKcv9tvXjQm6KRPc0VgLclebQt/7IIYSI1EKlRnqIeb7w35Pl1AVejAVD 2RnPuS1y2i0NvvL6j8k6eVL1VYB9heMjpVERKr3nwxA2nMp6Gw6cXYhfIOhzhzTzfOAZ QCEeRPpuXWFiWle3IAeGeoBuEU4IzxeZbXiAlp57zp1mp5aeanRac1HaszKttGIcSkhH ZbLak9bh0dCszjxKibo2nt4UgtZ55Gfx1bUo9QVw+oOWEnESyT6DGY33zWfBPQgGa7X6 Ho8+f+CGN5Ojp8HRCTiRipW/Z6DFkq1FeRdJlvWHMgohQWo7sOsxGXiLvofsqQ3BZVwp LzcQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=oWy5mspU; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-30768-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-30768-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id ky23-20020a170907779700b00a2f788a769csi255986ejc.311.2024.01.18.21.14.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Jan 2024 21:14:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-30768-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=oWy5mspU; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-30768-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-30768-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.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 3E99C1F23FF8 for ; Fri, 19 Jan 2024 05:14:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5BFE14A0C; Fri, 19 Jan 2024 05:14:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="oWy5mspU" Received: from mail-pf1-f182.google.com (mail-pf1-f182.google.com [209.85.210.182]) (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 4BF2A3C28 for ; Fri, 19 Jan 2024 05:14:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705641268; cv=none; b=tXnsx+6NNF4+GR6dPzOUhAlvUcWHZ3HxgGPUCx7Wo0XsP3s8TDp31cok/FVmfUra/R89EC9UqxI84tIRLxw9QzlSrr2H32sCWpYYx9HMSW4cPvvsiYK+yeTh5mEmn0Ytr0MR6bcfRVnM8gWD9+eRomznAl0eP5iszwC2kX+KeM4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705641268; c=relaxed/simple; bh=KDI43KBdy/+D0GsNm71MlYxAwhaV4JknyCQGlxwh4I4=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=Yph8AMnBjUoQWXy+ld/793WKcmJ8AFqmQF90GF/e8Pp0Q2tD1hL0+8deF0tGWQwhYVixT3b/aa60yE/s5CNO+ZxrMDJMzX0IFnzouZ7Z52qm0Svdh4uCG4iFyAcU64YsGqihmuwKaHRT8mJrQF3dKST5KtyQPMGI1a6M+k0OUg4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=oWy5mspU; arc=none smtp.client-ip=209.85.210.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Received: by mail-pf1-f182.google.com with SMTP id d2e1a72fcca58-6d99980b2e0so426124b3a.2 for ; Thu, 18 Jan 2024 21:14:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1705641266; x=1706246066; 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=wp3wjd4I+zVM5cxe6a7l/i+C674LfaWl8nrY3usedYE=; b=oWy5mspU6YPrjA1IIfl5XxtwtvHqYer7K1KQKl63BlJ35HCO6QF8I2xOWK5IUZn7VZ 8Uf4EawUXRNYHmmb2izi5ZBSitSX3w3FLw0+3hPnNKs2o1+UQVsNOm9ftsJ7gOS4b7Vm dcmoSS7V4sY0rUkmvTn7JZ3LcDHkHz86ogKHWATG7BORlDaH9mD5RrdyJ4Kldz3L2tGm yt2c02bN5gN89TUOTQzXOrPw6OJtE3fi1ufzmiu2O2xmIgUwd8o9Cyeax2MzCGRJytK5 s5Chch2Y/sxW3b+eZWfjOq9G47hVlirvHuhtSBm2+CNxoAskXW5ecyUV2QW6Kd9k3QY9 TtfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705641266; x=1706246066; 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=wp3wjd4I+zVM5cxe6a7l/i+C674LfaWl8nrY3usedYE=; b=axE/7TyrFq0CFOtmwij5eGoH4j/XMhsg52ppPu1ivHpRTSVob1KV0V6SMvlA2VbcdL Xggt/+0j+J/gq/kbV6I8z8mG/LMlxW0v4ufMb+14CMQCpLlZYPALm0vAnXiYJtO/kvwe 6O+w0mer+4/iDJ+b5PNa6mq84oexdFj5JBibv93yq7NpV9t73HTJMoyHHvWAmZaBSVnA dQpsj0eUNcYjJWk0pMR2zlYCGcSR83S13FV3utWXv0u12TLRB9ju5L6Ohz35u9ya6OiB Xwednmt2ZnVWl5PPVl9pmqZV22KVqX1Q39QlIznrkreXyefc93ZO0qD6mKxcDVAgDJRa Hqdw== X-Gm-Message-State: AOJu0YxrnxF/VAuWop3T0a+Zrk85Whi//ir/eP8LG+Bk/0P2bLnTDrfn 0fcGdgvEqKRs10pUMsVxA8s9w4saBA8/uYGTOF5uqKqeA2uSVNHy5di8b23HoYQXrTI3fRpRsXO Xqd/owie6Ud4hkMlwkphJxtwn7th9dV3vAMd9 X-Received: by 2002:a05:6a20:1441:b0:19a:57e9:905f with SMTP id a1-20020a056a20144100b0019a57e9905fmr2190743pzi.8.1705641266412; Thu, 18 Jan 2024 21:14:26 -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: From: Chris Li Date: Thu, 18 Jan 2024 21:14:14 -0800 Message-ID: Subject: Re: [PATCH 0/2] RFC: zswap tree use xarray instead of RB tree To: Nhat Pham 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 Thu, Jan 18, 2024 at 10:01=E2=80=AFAM Nhat Pham wrot= e: > > On Wed, Jan 17, 2024 at 7:06=E2=80=AFPM Chris Li wrot= e: > > > > 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 :) Ack. Chris