From patchwork Wed Jan 24 04:51:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yosry Ahmed X-Patchwork-Id: 13528533 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 77EDAC46CD2 for ; Wed, 24 Jan 2024 04:51:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E12276B0071; Tue, 23 Jan 2024 23:51:18 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id DC1C16B007B; Tue, 23 Jan 2024 23:51:18 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CB0986B007D; Tue, 23 Jan 2024 23:51:18 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id BD5886B0071 for ; Tue, 23 Jan 2024 23:51:18 -0500 (EST) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 601BAC04C0 for ; Wed, 24 Jan 2024 04:51:18 +0000 (UTC) X-FDA: 81712980636.21.BA0ADA5 Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.202]) by imf19.hostedemail.com (Postfix) with ESMTP id AADB41A0007 for ; Wed, 24 Jan 2024 04:51:16 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=XWz+Nsiv; spf=pass (imf19.hostedemail.com: domain of 3Q5ewZQoKCGgeUYXeGNSKJMUUMRK.IUSROTad-SSQbGIQ.UXM@flex--yosryahmed.bounces.google.com designates 209.85.219.202 as permitted sender) smtp.mailfrom=3Q5ewZQoKCGgeUYXeGNSKJMUUMRK.IUSROTad-SSQbGIQ.UXM@flex--yosryahmed.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1706071876; a=rsa-sha256; cv=none; b=ic2p4B1T0VwM3Ii1D8MhtsvZWdo5WCZSFSoMnWmUfeq8TpPH+M5bruU/Y2IA4T+GWqldMo xzpeqxrHKpTRXDLlwHb5n2y1w7YTZ6Qu4pAVeFWuheXDcE+hC3/+EILq38ml+kPL30E2w2 saCvXHHzAbg62gunMu0vhVL7W75Wby0= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=XWz+Nsiv; spf=pass (imf19.hostedemail.com: domain of 3Q5ewZQoKCGgeUYXeGNSKJMUUMRK.IUSROTad-SSQbGIQ.UXM@flex--yosryahmed.bounces.google.com designates 209.85.219.202 as permitted sender) smtp.mailfrom=3Q5ewZQoKCGgeUYXeGNSKJMUUMRK.IUSROTad-SSQbGIQ.UXM@flex--yosryahmed.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1706071876; 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:in-reply-to: references:dkim-signature; bh=TID2fOsjU/jpHwDMlLW9FAqgk4WlE0mPeuj0sjEkApw=; b=Lnjjh4zVfiLA3rz3ZuzgtGfM5PmRiIty0gL0lMCz1oVYeZUyHN47AqDr0gBQIgPKgVbxYO OKRaKzfIU1qMIt6Xc8nmopd8ufiICQ3i+QK6gFPitj0O2981iVJKKrdNhc/AgjCEb0AzL3 cVkNzyxXyLUe9iI0EaGBGtzUMcqAOYQ= Received: by mail-yb1-f202.google.com with SMTP id 3f1490d57ef6-dc223d528cfso7758759276.0 for ; Tue, 23 Jan 2024 20:51:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1706071876; x=1706676676; darn=kvack.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=TID2fOsjU/jpHwDMlLW9FAqgk4WlE0mPeuj0sjEkApw=; b=XWz+NsivolOmc7zaL3f1Oqs8Bn2fE+GM/zAT4wnPnGxTc+4qfhx3C35kmuEC1aX9qe 2btIczSNzwGyQH4SDaIdoWHrzkOd82EzB/tEjlNeRqcF5ISNmVKM4qqTq/51d0I4Dh4p L6r8EV9Rwrwke3HcnToc+vjcYjIM1eM2jMersw5yYrro/UuLMHEQqoCu0vzzGFS4FDbh 3ztSEzLJZooCto3ONYtLVNxVKjaHCuyzEV3+glMCZ54NUxSsUKZOX6nDLePAMQOyOkue Nq12JKsPP9NbOFb3oeirBB/QcCAiaqaJ4oNR+eyZ48D+cyOe3F2a9aHjwZIjiw/ucBa3 Ao+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706071876; x=1706676676; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=TID2fOsjU/jpHwDMlLW9FAqgk4WlE0mPeuj0sjEkApw=; b=dSYoVXhskrv4BtXcmMVvJaPbqmTDqBN+9nEqQ8urSKOP9gMqZCoR1bhXWwYIrBIr48 H16vjmrdxcRmlC+pnjscIndayXT0GE0DrtU+eRmyizrGFeYfC8rYuiCQFrDs/LXgDD1V chYZCuTvsTOU19ObHWaLhiHXExQ9h9WkR/JaJIkiQ+ypzBj/BUfhFvGJf93TpHChGsrM ksqE0d7ERDGsPxjtFVj+VcPEa+rbf3nQYxmGb3yc1knfl9o3/hu5/IFHiSQ4bk/kOIvV 20Ta1BuaFSP05cZObpPoDXFKmFiMRN6ZgO6anpp8smTACnmLu+RPAn5DzcyPQUFdk1+n x/KA== X-Gm-Message-State: AOJu0YyBgCxUB0tpJNzgT5Yi+SJ2MN4lNNyWfqIdQBCWn8X95/Z/WnaI ugXLCJQmTC++odsgm1q/4RBLAUCPq5l5CCklbogwGigvtJtqTh2it8kAY5H6XiPVGjIJYSAboYz XcNafD8zIRxlGNygMrA== X-Google-Smtp-Source: AGHT+IEKHRkvZtEqQFYQePKvwjkaz0hLWiFmv056VOKUYgz3ApLJR31SjOkQJQJuNissfgTKaLWLZOPKt3b2VyqT X-Received: from yosry.c.googlers.com ([fda3:e722:ac3:cc00:20:ed76:c0a8:29b4]) (user=yosryahmed job=sendgmr) by 2002:a05:6902:a8f:b0:dc2:5237:81c7 with SMTP id cd15-20020a0569020a8f00b00dc2523781c7mr151808ybb.3.1706071875767; Tue, 23 Jan 2024 20:51:15 -0800 (PST) Date: Wed, 24 Jan 2024 04:51:10 +0000 Mime-Version: 1.0 X-Mailer: git-send-email 2.43.0.429.g432eaa2c6b-goog Message-ID: <20240124045113.415378-1-yosryahmed@google.com> Subject: [PATCH v2 0/2] mm: zswap: simplify zswap_swapoff() From: Yosry Ahmed To: Andrew Morton Cc: Johannes Weiner , Nhat Pham , Chris Li , Chengming Zhou , Huang Ying , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Yosry Ahmed X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: AADB41A0007 X-Stat-Signature: ydtdr7n9e1cuxqc9gitepbpz4ok4qx9h X-Rspam-User: X-HE-Tag: 1706071876-901701 X-HE-Meta: U2FsdGVkX18L15h65pKRVzgtXTWKP1iQ6rVO3njDKRrYfjCD4jPCYfGwPPMMe7Qo4TKxvsrJLgYveuPUwHnY5PXbkAvuwfgreXgApm6WB8CUOtMkDOSauTPcfAZ34B++qlJDj9yl1KO46si59etQUucVMqc3tnJ62IdUsVQRtRz8gO8N2lPUBOMFFR/X20wdrAmKBemQCmijKces/yXi4VTtYE7YaUjoOKyglpfAXNHJ0nqwMhZSDoRcjmN54aqGeWapUJFkVdsb/xoc5HKavZFt5iL4vDC4F8VA7gSDhl3o/pSfGTsYTp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2RKxp2Svxu+/zYxbwqZymo3Wlmj3kqXXbsm4MOC1KtXczCI6GV1Y3ke+ZtMrBiV2KXkRcACv7S1jZx/ZlcnXfg/nBhLJd+ekHEHT16qij2KxVAKLFfuTPdBrepipAzlCildiMWtyJr5k4vYVbU8Uuxz+8V1lLRaRr+VP3v/FXS+FIqg9vNr7rfLz1jYfDJPSkaJBNzruhmh5sK0sMSNUqIiEt9Igsr3JmUFsFLmXgAEtiNSzCqu8QDWhiACN26a0Ie+/ejZIkOJ2jroc9hFdZupBB3m85t3oodRmBN4zogVOur1kGwUJrrKTx8Ce7CDb7w22bY7t0gmrHeM6yzMxwKmR6aQuuL7RjPJzcdo6SF2+H7kjVdcrNNDf4pih36HUhAzhx7KYWpOauw== X-Bogosity: Ham, tests=bogofilter, spamicity=0.002404, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: These patches aim to simplify zswap_swapoff() by removing the unnecessary trees cleanup code. Patch 1 makes sure that the order of operations during swapoff is enforced correctly, making sure the simplification in patch 2 is correct in a future-proof manner. This is based on mm-unstable and v2 of the "mm/zswap: optimize the scalability of zswap rb-tree" series [1]. [1]https://lore.kernel.org/lkml/20240117-b4-zswap-lock-optimize-v2-0-b5cc55479090@bytedance.com/ Yosry Ahmed (2): mm: swap: enforce updating inuse_pages at the end of swap_range_free() mm: zswap: remove unnecessary trees cleanups in zswap_swapoff() mm/swapfile.c | 18 +++++++++++++++--- mm/zswap.c | 16 +++------------- 2 files changed, 18 insertions(+), 16 deletions(-)