From patchwork Sat Apr 13 02:24:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yosry Ahmed X-Patchwork-Id: 13628594 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 D65CBC4345F for ; Sat, 13 Apr 2024 02:24:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 30E2A6B007B; Fri, 12 Apr 2024 22:24:13 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2BE1F6B0089; Fri, 12 Apr 2024 22:24:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1AD366B008A; Fri, 12 Apr 2024 22:24:13 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id F1C316B007B for ; Fri, 12 Apr 2024 22:24:12 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 7117D80452 for ; Sat, 13 Apr 2024 02:24:12 +0000 (UTC) X-FDA: 82002913944.12.C232143 Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.202]) by imf03.hostedemail.com (Postfix) with ESMTP id BBD5D20003 for ; Sat, 13 Apr 2024 02:24:10 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=opa1FSo8; spf=pass (imf03.hostedemail.com: domain of 3yewZZgoKCEI2swv2elqihksskpi.gsqpmry1-qqozego.svk@flex--yosryahmed.bounces.google.com designates 209.85.128.202 as permitted sender) smtp.mailfrom=3yewZZgoKCEI2swv2elqihksskpi.gsqpmry1-qqozego.svk@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=1712975050; 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=wFFGQr1pf14z9aosyZeKotH6cupQu6AQgo5orkTHue8=; b=GkcuCyMqGOMDH8tfz6fWcmDi3oGuqiAzMN01f7nEFIQ+p3c8+13YyRvhSWz9eisVgi8ECt pAW02gZHQijT+wl2PvHVaOmDjdgRAiLY0lTEdxXiM+bby/w+2boThcInlQIffmeJ5Ariyg 3Z7K/OhVTZE/KRAeYUgrS3Sxdw0WKK4= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=opa1FSo8; spf=pass (imf03.hostedemail.com: domain of 3yewZZgoKCEI2swv2elqihksskpi.gsqpmry1-qqozego.svk@flex--yosryahmed.bounces.google.com designates 209.85.128.202 as permitted sender) smtp.mailfrom=3yewZZgoKCEI2swv2elqihksskpi.gsqpmry1-qqozego.svk@flex--yosryahmed.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1712975050; a=rsa-sha256; cv=none; b=4Xp5VIGbpfiBFTadfNSKjDy0XJw8XGXuMnZmIi3PQwU8DTpVP5aburzZFqKSU0O2tXdYjr 2tPxaTtg0Y7BgCEhemzqiHjP2CkcoG5NQJDyUFOgpHW593tXKrCLZH26gitOk74aTw+V7L +fdWi2V1QaieE/EXzz0jSzXy2FeWX7U= Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-6150dcdf83fso30140497b3.2 for ; Fri, 12 Apr 2024 19:24:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1712975050; x=1713579850; darn=kvack.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=wFFGQr1pf14z9aosyZeKotH6cupQu6AQgo5orkTHue8=; b=opa1FSo8BYsr/o5g+wk6bMheUrgMLfrmDDpZpAthlfqzO9VSyMWqbXTrMB6DreThkx f1uCWF7ovmzeBoaP9gAHBdHbLDHBVUMwhRa2OpRW1u5QXxn804Ka0jeDD3HRJVU6OUdf kSsIYdP2/nrTs4dGoZhq9Dd898GAZF0khGXLUGtSjCLOlqY/Y+84MRJmlrHQuJbp3q+z mvp30EwdUXyZ48N/SEOKYCaeNKPM5r4yGRTQMxAMJgJsKAdq2o7M4i86qQDuy0SZcGde 06CQK0qSotS0ILVT91oEtkHxMRv2Q3WgcGGXCfHlRO0Huto3gk1rrX21zNgC/d886my2 ou8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712975050; x=1713579850; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=wFFGQr1pf14z9aosyZeKotH6cupQu6AQgo5orkTHue8=; b=SMcu8hlhzjbNmoWGCdChYCWbWy+BJFV3BWaqBnWNBuatX6vWN1+xrkmdJgvCo/7n98 CyArzp5knLV+JPuayfAa9hIl2SuNdkxkfR2huK7JKSqRx2XYyB5EW7IOD1no3mc/ki9Z 2F9myDnvNFWHU3iB6BweWew0UGmppb8SbuRVNkvce447f3JTldaUluOad/Fp8zXkhD0k AU0Ol+6zMiMCg8czgp0efzB/4/6Ch4ib8zj4HLauFOSGF3mZONTb0H/9PXBEORlFZobO F/HJA6k/84seh5DTzOJXoiEUdbj82fn8tHk1Tok7ghNHKCea8/jRwP1PHg/ABHZE6WFH Q6PQ== X-Forwarded-Encrypted: i=1; AJvYcCVfvQc5tN43TDuhnR+VtQEFRE6SgEirPIMQVhfZzayJTwUgy4ux6rNTRgYeNbYbZg2GiM6BI3jOq+jlCP0d2PTTXYA= X-Gm-Message-State: AOJu0YwdEgZ2sQMDAUjMYxTDFS43Yfq8FJKXLCYXskHnaV+Xvsp/Cb36 pT2r72CQU177g3viaeN91/2jaASff9jTjCuF2lXo37LKBwTrGFH1rJIgSO9J41xl8hZ8d/AB8CG IvpXpbB7fkd7rYl+PSw== X-Google-Smtp-Source: AGHT+IFRiWASJIbrkPdJYq5ZC05q0I8eCLRx/z5+EwF9l+oRPIVuyPKm+SFly7alar1UZwBBx/JXKNlwjQJfbCt2 X-Received: from yosry.c.googlers.com ([fda3:e722:ac3:cc00:20:ed76:c0a8:29b4]) (user=yosryahmed job=sendgmr) by 2002:a05:6902:18d5:b0:ddd:7581:13ac with SMTP id ck21-20020a05690218d500b00ddd758113acmr1288518ybb.2.1712975049669; Fri, 12 Apr 2024 19:24:09 -0700 (PDT) Date: Sat, 13 Apr 2024 02:24:03 +0000 Mime-Version: 1.0 X-Mailer: git-send-email 2.44.0.683.g7961c838ac-goog Message-ID: <20240413022407.785696-1-yosryahmed@google.com> Subject: [PATCH v3 0/4] zswap same-filled and limit checking cleanups From: Yosry Ahmed To: Andrew Morton Cc: Johannes Weiner , Nhat Pham , Chengming Zhou , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Yosry Ahmed X-Rspamd-Queue-Id: BBD5D20003 X-Rspam-User: X-Stat-Signature: jdspnq15mqmh4drog8ic331i49mb8c9k X-Rspamd-Server: rspam01 X-HE-Tag: 1712975050-144152 X-HE-Meta: U2FsdGVkX18DvNPocTnG4rwglxEF6GUlzPibH2cRvumKRQolvdN5PBKa5de/z/G4rpwogIm/5kweabJ41rIw5VxCO93o4yvVVfY84vyJa9TRgFLpnb8IMPz/Nyr2/bKjL4Wzfu3F029Dkv5/DxgXGosx8AItq2lmxWtoSfLy118mNsPxvWVi2Dgr6+iRrncPLtHTGQKNGOSH+yp0K8HtRXelnFeIo2cvEPOoMmzqxo+fMaQ8TDLz8YNAAsLVuQiZCbrbkXa/+6L2BdXhQLpfyf10YXfkYt0D7Yn5zcocJ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hh0IdaQbKTnLcgpTpi94nxMBXNQDG0c1VLLrKQV3Zk+/r7Kv+XQxYtKpfpdOgVXmLVbPDx4OdnxW71AtSdTLIpfXUv0fZyV9LvFsSrxHPvxIZe1NhrL/cEJleBKp7ooNS2zVUvvH/qRyg3m557X7Bx/t5C2t3eA8ChkODJERQ20NcilmULdeCkmESGyGMpwj8qNAfeMAq8HPBDQXw15Pr2nV6P/RMtS1LahrlQNghho9oVBMaP2Kw0Cdw6i8u2rYxKXUz+qZcvHfBP/7lxLeeHAmjbni0uFkcdoUu3c1u9SdnxznhJ6wLyOhfqIwtcUjTG 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: Miscellaneous cleanups for limit checking and same-filled handling in the store path. This series was broken out of the "zswap: store zero-filled pages more efficiently" series [1]. It contains the cleanups and drops the main functional changes. [1]https://lore.kernel.org/lkml/20240325235018.2028408-1-yosryahmed@google.com/ v2 -> v3: - Dropped "mm: zswap: calculate limits only when updated" patch after discussions with David Hildenbrand about the complexity of adding notifiers for totalram_pages changes. - Restored "mm: zswap: refactor limit checking from zswap_store()" to the v1 version, and addressed Johannes's comment about deferring the call to zswap_accept_thr_pages() to avoid the division when not needed. Consequently, dropped the Ack and Review tags from v2. - Added a separate comment header for same-filled pags in patch 2. - Collected Acks and Review tags (thanks!). - Rebased on top of the latest mm-unstable. v2: https://lore.kernel.org/lkml/20240405053510.1948982-1-yosryahmed@google.com/ Yosry Ahmed (4): mm: zswap: always shrink in zswap_store() if zswap_pool_reached_full mm: zswap: refactor limit checking from zswap_store() mm: zswap: move more same-filled pages checks outside of zswap_store() mm: zswap: remove same_filled module params mm/zswap.c | 98 +++++++++++++++++++++++------------------------------- 1 file changed, 41 insertions(+), 57 deletions(-)