From patchwork Fri Apr 5 05:35:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yosry Ahmed X-Patchwork-Id: 13618543 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 2D3DACD11C2 for ; Fri, 5 Apr 2024 05:35:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 71A9C6B00E4; Fri, 5 Apr 2024 01:35:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6CB006B00E5; Fri, 5 Apr 2024 01:35:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 591B96B00E6; Fri, 5 Apr 2024 01:35:16 -0400 (EDT) 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 3C29F6B00E4 for ; Fri, 5 Apr 2024 01:35:16 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 8C03140800 for ; Fri, 5 Apr 2024 05:35:15 +0000 (UTC) X-FDA: 81974364990.11.6282F43 Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.202]) by imf19.hostedemail.com (Postfix) with ESMTP id C54BC1A000D for ; Fri, 5 Apr 2024 05:35:13 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=XqR58iuz; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf19.hostedemail.com: domain of 3kI0PZgoKCCEVLPOV7EJBADLLDIB.9LJIFKRU-JJHS79H.LOD@flex--yosryahmed.bounces.google.com designates 209.85.219.202 as permitted sender) smtp.mailfrom=3kI0PZgoKCCEVLPOV7EJBADLLDIB.9LJIFKRU-JJHS79H.LOD@flex--yosryahmed.bounces.google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1712295313; 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=06arm/eh/IG4MSYj80TJZLH0KdxVku2q8wYVAMxWBVQ=; b=H1y07W7hhVxYaJRs339umXvSty7T1ZjRGtUBNdqFmKraLNyr2Gw97SqXNIOmap9Xi1ltx3 h2313Hf/l5VsVCPIhe6KkpPDOEB/CA6G+pnLiSLJHO6Co9dqFmQ3sL8swS8a/6O4RMu4wJ vOWmKbjawxLCZQL7tY/TPvCvQ7B2SKQ= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=XqR58iuz; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf19.hostedemail.com: domain of 3kI0PZgoKCCEVLPOV7EJBADLLDIB.9LJIFKRU-JJHS79H.LOD@flex--yosryahmed.bounces.google.com designates 209.85.219.202 as permitted sender) smtp.mailfrom=3kI0PZgoKCCEVLPOV7EJBADLLDIB.9LJIFKRU-JJHS79H.LOD@flex--yosryahmed.bounces.google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1712295313; a=rsa-sha256; cv=none; b=BlrDJLvt7PPNTRcQ3IsRrWulGUZisKpAnv5fdpPHkEy/MRqdTVyMDpu9EXc2wZGAX2m+52 2t0Wh5hk1n1CU8fJhurpRmb6Or1gbwC1Coyov9Ez0FuSDATRbcoRu8SXNhVZ3Svo0+a9gi LXSlOiSVuCmuvP6oUAmUD8Sxbef/zPA= Received: by mail-yb1-f202.google.com with SMTP id 3f1490d57ef6-dd1395fd1bfso3302189276.0 for ; Thu, 04 Apr 2024 22:35:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1712295313; x=1712900113; darn=kvack.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=06arm/eh/IG4MSYj80TJZLH0KdxVku2q8wYVAMxWBVQ=; b=XqR58iuzN7M9LBjTrdir+GcQDJiySGhjI51RnEzkret3rTssIFtdPY2H86h4X3/qQU +XEE2Yio/IpAkV4fAsYuNR6OuBFtpfftaVz9FqhFHUaCLmDgy2uFqyF7Rnd7BZupKltG YnzG3tGtb+gd2MytqNtn7aoZ4ohWTV8GfhUi+A3del+d7mrv99aKhh1qcYWP2TimHob8 PwEjULU9dRg7bMbfCwbRFPyq0GNbPJywJ1JHaPScWNIc7thZwLcGIwScXwkCCSbLq2XH d1vcAfF8ItpFg6e8SeaaJUeqU0L0g5tRRXGpzv44NRc/sMcQfvH+R7tTQhbmzmWPBasr 93tQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712295313; x=1712900113; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=06arm/eh/IG4MSYj80TJZLH0KdxVku2q8wYVAMxWBVQ=; b=nJ7fR57ImVVvDsaKFyrSD04lTbSnhfuHrqW9rHoNQ8DVnKcqL9WG8AujaDBx/13HZG Pu/pVbtNXlepNQ7KYfrjvvcFZeu/JTqI0GSboa+V6fAVQYLk3MEwLQ5DmQ44YImoqQxg 9/Yj5iWxmqQmW44dvufFMB1EluayMprx3H4ELnDNest5aV+LPfnr+YRXaXbGPC63uh/t 7HN6mgayzUwtmbwYgkmIkZlml2l7AzT0B28K4FmwRukdGS2EqZpmGYJuqKYUgZG0d5K+ 5rEdfaDNU+TZaYm/OlKLqfnrfwKjKylyVAlsLnyMwe03erV71Fn0sTq9pEboJUVlaZXG SNog== X-Forwarded-Encrypted: i=1; AJvYcCW6wQY04bOdSsu087V+AJXUZcY+aKkHCI4mJkXkZDAP5fGupNvPWw8XyRlbkEVzJr+VhpwX7Sbd/lDanzcmMIY7AO0= X-Gm-Message-State: AOJu0Yw5jyE64mgrWH2jwZ4+g9ufLvGlbg9MykwymlPd3hirUNs0WeLZ 34L2AzstaEUAhRFbBObEMjED6KvuWcCB968mHqiySsSj/CVoDi9NdE8wKB4UWj5qR/pUGvoGkTz XlN/Ld9KXY65lgE2ZYw== X-Google-Smtp-Source: AGHT+IE6i3UnSDT7YnaXJXwXPWBurYQcKzrhShLF6qFVFGRFCLFOPVeeqF5U+RuUJhJL0d4AdzK5Z9K6mEfbnsob X-Received: from yosry.c.googlers.com ([fda3:e722:ac3:cc00:20:ed76:c0a8:29b4]) (user=yosryahmed job=sendgmr) by 2002:a05:6902:1207:b0:dd1:44c2:7412 with SMTP id s7-20020a056902120700b00dd144c27412mr106466ybu.12.1712295312807; Thu, 04 Apr 2024 22:35:12 -0700 (PDT) Date: Fri, 5 Apr 2024 05:35:05 +0000 Mime-Version: 1.0 X-Mailer: git-send-email 2.44.0.478.gd926399ef9-goog Message-ID: <20240405053510.1948982-1-yosryahmed@google.com> Subject: [PATCH v2 0/5] 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: C54BC1A000D X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: 766sbukuq77j84dmtwawz43pizo8ziqg X-HE-Tag: 1712295313-395025 X-HE-Meta: U2FsdGVkX19ETQyGfaSkD7AH7+fzuWRwbyWvTPc/4rAhfUBrQO+Gdx+DrG7Mm7wiOjVdJ1YnH0Bb6oo6fGVCG4GJtgOWUM5RQph8spWGBfW7Cz9c07zNh9NGToMip3mzrTJoKrk+kIzdu899/95OQiq53BWneK63uV/FtAxQbfyomCGNeGc0WS23rreJWbHZHpsKkpSXG49jBvWYiMloFV0+Uyim/DgNer0pg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S7cgccSi3O5AqxtONGHXYIEZrGKiUl4aUvDVcKL/NXF2l5ZzCV+q4o39aiOls8tUkR2iRTM1r5MEZAcZwCXQ1osNHqeeBEX+G7aymUPkPHEIZ0MzrC+rlA5jAi3Yb0hgp01SILiFaeI5io3s7nyc4yAOuJNM/ErUVuoQPrXJacp8nn1XQXXcVgFO9AM3iQ32Jtifz71RFdlsHCd42g1R6bYIxjqr7TtS9ysfVACnTzH03M2RAntM2IpwkEoCKCeQsY41DeS5eU/xDUW0GjuzFxw8Ku1SEva8lKDpUSUWZzxNrLyG0h9sNGA/Y+58LqTNNqZuKjLn6Gc+dE2L/49Q62uCj8AU69mz0Cs2WbhHmBBnMxCJRjbKLkkcyj2gevuzHHXqBNpLZ/J5k5v2I/F36cZyEQ2Y963TejQFdw== 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/ v1 -> v2: - Dropped the patch to skip limit checking for same-filled pages. - Added a patch to calculate limits in pages only when they change, as suggested by Johannes. Yosry Ahmed (5): mm: zswap: always shrink in zswap_store() if zswap_pool_reached_full mm: zswap: calculate limits only when updated 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 | 169 ++++++++++++++++++++++++++++++++--------------------- 1 file changed, 101 insertions(+), 68 deletions(-)