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 C5EEAC54E68 for ; Wed, 20 Mar 2024 00:20:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id ECD546B007B; Tue, 19 Mar 2024 20:20:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E56AD6B0083; Tue, 19 Mar 2024 20:20:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CA8F26B0085; Tue, 19 Mar 2024 20:20:41 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id B5DA56B007B for ; Tue, 19 Mar 2024 20:20:41 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 2EB10C0262 for ; Wed, 20 Mar 2024 00:20:41 +0000 (UTC) X-FDA: 81915511482.16.39400BA Received: from mail-il1-f172.google.com (mail-il1-f172.google.com [209.85.166.172]) by imf30.hostedemail.com (Postfix) with ESMTP id 1FEF380006 for ; Wed, 20 Mar 2024 00:20:38 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=chXaAdnJ; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf30.hostedemail.com: domain of chriscli@google.com designates 209.85.166.172 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=1710894039; 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=wSsx77JW3Y/Bq0qf/qFd4CC2XBBPtaZoUOPGSlrJOu0=; b=kMcF8cj1u1tRyEEsRMBQB5rKLZOL7wiMNpFNKpporFhNquZhf5zlpybo4SmiJvVOX9cWbM S7jvT4ZXAE6uIJfiPHvVnlJ7589lQEZPDXheh2TURo5QNSMXf/q+AcL2qDhwTXmo8SXUqn wBe1u5k7vcOVEmlBzx/5pfv/EuY2ShI= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=chXaAdnJ; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf30.hostedemail.com: domain of chriscli@google.com designates 209.85.166.172 as permitted sender) smtp.mailfrom=chriscli@google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1710894039; a=rsa-sha256; cv=none; b=1xCewVy8PQVLfvORFEeTF+Zlx0MuwWQZWA0miB3HSSu0fTzUjxsKslrmRNoohDgy30F9LA zCvV+fq96Z0aFMHh3duhSHJfnrDfoEUSuKfCJCQ28VjrFIC0qurjJYeqQqSNJYzvCm9rz4 7dyyHQ3lZtwkavgqajdJAzTqfqUC78k= Received: by mail-il1-f172.google.com with SMTP id e9e14a558f8ab-366bed3a440so11800065ab.0 for ; Tue, 19 Mar 2024 17:20:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1710894038; x=1711498838; 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=wSsx77JW3Y/Bq0qf/qFd4CC2XBBPtaZoUOPGSlrJOu0=; b=chXaAdnJZnhog0/iyKdTnOgrtezRO4eFkDWch6IR23EXy5HcsURmg7LYxiJJGVKwur RG8NZgEK3gv7Ds217i3mKzbFzgB8W0SnK4/ie+LRskIVdmJSmXUcRu15RvdBzBncqheC /gi3EyjjSMFmfRajhaAKJR3VvDG5Nqb59/74i0lTUrclzquofxg12x2faR1X1SDUtHuI jsqGvkd2sOAZxxUgablKOgeaT9xPv5apQvu/5xAMNw4i+hJYykFLpptB7OEpNasOsAfk hIBP0PgrQRB7mJjbHcXRhadGryFwzx5gClCylWdlgkMTp0n3DVY6ouV65dErIHtAzNab 3l5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710894038; x=1711498838; 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=wSsx77JW3Y/Bq0qf/qFd4CC2XBBPtaZoUOPGSlrJOu0=; b=FpXP3bUfYK2Bm50J8JqS4umEb6ZMwFWwjryeChXeGA37ouKXY5cAMqZq8QM+rJTOo/ vLx6XrF0TY5olVnV6P3/sp10qYKfhvQygR2GabEboBElTg5yiXZorhsS3vYtPfFAnNqt n6IlKlq14q7TatKfCpkPBUTnvbaIZ3nnmjo/FZHa+EMZ89C3KqWD9PxXFRQh66R2Jw/Y vQZAcR1dJClAjE5sgPd0UXtKFqBbLgeCDs3skQdTne63tX5nNGG/9GMTdnPYH0DVtYAX qh1Ggc6D5rmVRO+qhb9LeruwfVnKVQwjMi4OoehC2Qg7nyo8Oe1YvQ+kUTZm4dv2Jhy6 iebw== X-Forwarded-Encrypted: i=1; AJvYcCWVt1A9Q4OmHiqAi5XwJLrStv/b86kSrUGd9SYhSzcWP/qyzT6B+KwhEDdwR+2OtO7PEmTKLIsftPv5wJwdgW9N5o0= X-Gm-Message-State: AOJu0Ywpw9R+Cop6wbgM8Y48nbnKlou5IWe6Esbf0XbFJZJ2TUYoOFof rZn7Skfofc3GdbS7+5G9fy38jW33fqQHi/HoTfX0wtcv5hWRFT4uhym1VGm6M5956/a9WdSqxoB TlTl2ocx6E80zVLFxiFiqguOtX+oGtNnUaYKh X-Google-Smtp-Source: AGHT+IHlaHRL0umHFmanp7quVlbQlQ6CW7wBeJ94tmd7VgEjhUvq3w4XtUlgvBdTcvvAR9k/aJ3co8CRBThiIs8p5Sw= X-Received: by 2002:a92:2810:0:b0:366:bd79:a567 with SMTP id l16-20020a922810000000b00366bd79a567mr558869ilf.7.1710894038141; Tue, 19 Mar 2024 17:20:38 -0700 (PDT) MIME-Version: 1.0 References: <20240312-zswap-xarray-v6-1-1b82027d7082@kernel.org> <20240316133302.GB372017@cmpxchg.org> In-Reply-To: <20240316133302.GB372017@cmpxchg.org> From: Chris Li Date: Tue, 19 Mar 2024 17:20:25 -0700 Message-ID: Subject: Re: [PATCH v6] zswap: replace RB tree with xarray To: Johannes Weiner Cc: Yosry Ahmed , Andrew Morton , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Nhat Pham , "Matthew Wilcox (Oracle)" , Chengming Zhou , Barry Song , Barry Song , Chengming Zhou Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 1FEF380006 X-Stat-Signature: pu816s1mzu7bbobd4aahg9dej7wegfng X-Rspam-User: X-HE-Tag: 1710894038-417324 X-HE-Meta: U2FsdGVkX1+fsbaoKOKNSXJ3kgZcpSHmB8b62pcTK2tf3MNzlLaD4b6Mx3zLGdXHaLxHnVMKWMurY1ixrJu3R3Fu5dihHgJr2RtTmAqnitknGdQc5RHbiGLRMbT/fN7GezO7ANiTfKDAM2MkWJNCYzuS8ud5kQdpobw+ell1nRlpP6/0ZZJN1RXmhewRBoJElvAZhVgsVCubIVbT8jLeeakXkqv0fQeh494lAnv3GaSJiK1QULzLNB/3uvJxiDvR0lIRZV9e2FRmHWZppUM/mMQvocziJIMwSu1H4/fFXedhCuUJi+SDoe/Djj4oFmaA5KP3RlRHi2A+QyUUj/tu4pcAH/MFXrcQvok/H7ln1Um9p3S98ri9MToAz8sseg5ltamFAI5QKNH820bV+PLKlNHW1gghPZ7Gsy0MUpzPR4vB+j+DWPtkyueNpe4IILEbqt6x8/8RtiPg+zIvzydhKwfhQUFEvjnmmDu2cMb4zEf9nmqhqpTdYBSMBuro3l6FvIgH9S0tQNOrkiFj/hiPo/Hf/CRa35KzRcebxeHcsWo8tEUZVEx2w+YG4KCKxP60orsI16uVe+vRYjG85DZX3bKQcSUW22JzEjUYrMXx0xRzKM5dBwFSE/CBX7X8PijHDa71D0pQhdiMoyD2CaP82qrWTDIpvP5G21KSCDFWRHQak5DJ85LUu5qRikgEhuem8qGtY1v9DzPqMBlsiLHX82PLkJWbUvUzZNriQyHBeiO4+B3hwGU7cSbXhQgferSUf9X91ByOUoycSWczrtWYFXUYKJI6UHnO1FwSs10XSIlh4YNiFcs3ntLEW/ZQxGt1JOMYyYRQZS+dj7IaHkJmwG/k9NFAC1UTss1H8QcJyMw4jbEmRrzV4G74EPen9p2UMUCrKlV0ZzV1SOrlTl/BogrI9VXxOPe+fzJUx/k1PoIJANl5/CLfTMg7rELRXwnj9l+J6CCHDz6o4nZwF3T 0Kdob2Cn IF0MkVPGpFe6XBU9bAYafoP02dYKuTL9mskTWLEYaMhaIwXjOmymrkXKhckFNtHWzJnUf5kfxM6H7hFLqwHuUxo5O3IwgiDV7E0ZxfPbja0YXk1lvR1/4BgpTPYa6IW24TQWU3sRgcP+bMXEKGuVWQtedsEB3sbgdTfnmRFDWOr5xZqUFigSDdB6A+YtFR8fpmXqkEVOcDk1gl+wNtRvFbhKGX0t502YOl8MJ4CQDy17PLxkKIpBn/WV+a3WqGHAPCejthNBeviyjf+QEQZ8gowOOewUn7qGwxz3/ X-Bogosity: Ham, tests=bogofilter, spamicity=0.000001, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Sat, Mar 16, 2024 at 6:33=E2=80=AFAM Johannes Weiner wrote: > > On Fri, Mar 15, 2024 at 06:30:37PM -0700, Yosry Ahmed wrote: > > [..] > > > > > > @@ -1555,28 +1473,35 @@ bool zswap_store(struct folio *folio) > > > insert_entry: > > > entry->swpentry =3D swp; > > > entry->objcg =3D objcg; > > > - if (objcg) { > > > - obj_cgroup_charge_zswap(objcg, entry->length); > > > - /* Account before objcg ref is moved to tree */ > > > > > > I do not understand this comment, but it seems to care about the > > charging happening before the entry is added to the tree. This patch > > will move it after the tree insertion. > > > > Johannes, do you mind elaborating what this comment is referring to? > > It should be clarified, updated, or removed as part of this movement. > > Wait, I wrote that? ^_^ > > The thinking was this: the objcg reference acquired in this context is > passed on to the tree. Once the entry is in the tree and the > tree->lock released, the entry is public and the current context > doesn't have its own pin on objcg anymore. Ergo, objcg is no longer > safe to access from this context. > > This is a conservative take, though, considering the wider context: > the swapcache itself, through folio lock, prevents invalidation; and > reclaim/writeback cannot happen before the entry is on the LRU. > > After Chris's patch, the tree is no longer a serialization point for > stores. The swapcache and the LRU are. I had asked Chris upthread to > add an explicit comment about that. I think once he does that, the > objcg situation should be self-evident as well. > > So in the next version, please just remove this now stale one-liner. Ack. Chris