From patchwork Sat Jul 27 23:06:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takero Funaki X-Patchwork-Id: 13743805 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 BB4B0C3DA61 for ; Sat, 27 Jul 2024 23:06:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B067E6B007B; Sat, 27 Jul 2024 19:06:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AB2DD6B0082; Sat, 27 Jul 2024 19:06:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 97A316B0085; Sat, 27 Jul 2024 19:06:50 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 7A56A6B007B for ; Sat, 27 Jul 2024 19:06:50 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 8B89C1401BA for ; Sat, 27 Jul 2024 23:06:49 +0000 (UTC) X-FDA: 82387069338.25.B78965E Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) by imf16.hostedemail.com (Postfix) with ESMTP id C618F180011 for ; Sat, 27 Jul 2024 23:06:47 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=Mh+l3Np6; spf=pass (imf16.hostedemail.com: domain of flintglass@gmail.com designates 209.85.214.179 as permitted sender) smtp.mailfrom=flintglass@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1722121557; 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-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=asRqtKXsywbzrAcCEkTYZ9u01rG3hLmaFH3A9iaCAfM=; b=y4KcCtygSJ6QvwWqBiA5+BzsznxvEfEbuY6h6PxZm2tl3aDTGhXdFLfwzoXIxeO/VSdYoE caF1+MBDbodQMsfK/+vvsSlE6G2JRhnu6IEdWbJat4TgWzb3feabigEnHFlY6hQv+F14Rf q/ehbMYdY2n7HXO2uOyxxkTRN9KDjMA= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1722121557; a=rsa-sha256; cv=none; b=vAB2HUq+eb+VfwmlP5dNTjfmMZ8tRfjHCAdcht8pb9WgF9aEQrQEa6eX61zeovAte2p5WR tzK6vzUMXOJ/PI47Zwsop0ciNh5s/6NDg1jlxcVJav2rzikQSxxUpkWK4FlHi+oVbHRPhQ /wmKSjWE/BeYCGZz28cVmycgwfos7Lc= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=Mh+l3Np6; spf=pass (imf16.hostedemail.com: domain of flintglass@gmail.com designates 209.85.214.179 as permitted sender) smtp.mailfrom=flintglass@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-pl1-f179.google.com with SMTP id d9443c01a7336-1fbc3a9d23bso11764075ad.1 for ; Sat, 27 Jul 2024 16:06:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1722121606; x=1722726406; darn=kvack.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=asRqtKXsywbzrAcCEkTYZ9u01rG3hLmaFH3A9iaCAfM=; b=Mh+l3Np6iZNrHyCZGFi03Bgesq5C62PEhuTcajmngZB9HTlTZanWOTXQIJ3Nv1CAWw lTwFVNUacZoG4ptw2G0W5YyJh9/3zCzbvZYsSYUNZRxGkC5F1Nk83uIjeRFGgYhAR8V3 pePkcDEX70u0S+b8NCZdg101dJXhuBC9LTgamO/u8NNz1UILi2uegWj7/phTcEr+cfl1 GyEVNlieMO5VzSP0McQ9TUcl33sh8LB5Vw+UDLjVI4PeRPW6YRzsIqml72tUQUzuq7SI NxG2jGxRIZ4swbW2Do6c0oe/lh/MOnjs6aot6xsSAPugLMC8DkprQ4/zgjUopqPq/UAT u+ng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722121606; x=1722726406; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=asRqtKXsywbzrAcCEkTYZ9u01rG3hLmaFH3A9iaCAfM=; b=mdtz5zoH9DIc60hsHgs4yDY7nJpBemm4lHAOCPmTyXDqFVpBeCmQTLol4nHNgIi/rC 3X/wmAsDH+jLHO4pBwHdTs1uPiyBGoucijIHoXrtZ635dmo4j18qQBd+duw29T1VB2Vu lIQyLGQdcBAZoSwcGd0XYwtFne6Co5q3VPZ8ADyb/H8JnCTmcS73f/5qQ0o9VHsaGlm/ aiu2WNANg6ev1E+ouoa4KSyy3392BOsios207Vjld7RExXTfzz23MmICatz4eV2aLPsV oQeRhJV1bZdtSKWHxUMvTmHhkEZUVVRndDClkx4mdYzmQ0UNJ8xvjEdy6JJCue1OVbwX D9/g== X-Forwarded-Encrypted: i=1; AJvYcCX2Ne4YptQqHW+azCzkUp6eqNI0YdnEQKNjfN8OJAKZu55a2xiz1noBHiNyqtMaN7yB/SMoRlPTI1RSyuGTZB3i0Kk= X-Gm-Message-State: AOJu0YxqXqF5xm8TwAZCjQRfADOGPs1xBgLoYKgveRD1PRPNlpJx0JAm ODKSl/9FCtRfMOayMW1Bq9HrzznpNl2EeOu6fBDZ7/zSRC9MmRny X-Google-Smtp-Source: AGHT+IGbZwKmuPAl4mE+aNxHvQx+qP16j9O2vdoVqtxjnkCEpqYfTNptOeMJddk0zlMom2lADyZlbA== X-Received: by 2002:a17:903:2302:b0:1fc:369b:c1dd with SMTP id d9443c01a7336-1ff0480893bmr36504385ad.6.1722121606234; Sat, 27 Jul 2024 16:06:46 -0700 (PDT) Received: from cbuild.incus (h101-111-009-128.hikari.itscom.jp. [101.111.9.128]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1fed7f274a7sm55881145ad.209.2024.07.27.16.06.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 27 Jul 2024 16:06:45 -0700 (PDT) From: Takero Funaki To: Johannes Weiner , Yosry Ahmed , Nhat Pham , Chengming Zhou , Andrew Morton Cc: Takero Funaki , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 0/2] mm: zswap: fixes for global shrinker Date: Sat, 27 Jul 2024 23:06:28 +0000 Message-ID: <20240727230635.3170-1-flintglass@gmail.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-Rspamd-Queue-Id: C618F180011 X-Stat-Signature: ccgnfud19hbcuwsitrc34graoezezu4e X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1722121607-742464 X-HE-Meta: U2FsdGVkX1+7I6Uxvi5j4EQ6eqznmFqrjVChxKVLo2m7mUC0b2XoIuZGLAyYO1wYnQ+W0KYCKo5e65foIWaIPYx54BrQBkI2V128FWW8PxoGhLaRn/ni1vzmulm+Bv2OD5/EBjLQdxoSMzA4o27l/i9w03x7OHt4hiBlllsPAGz981h+JZGNO//k7oTwYJPW1H/VKevGwx4EGDWZMz+lBtZL+5uFQ0XaICeqQMJ7g2rzD8GiH0gvq0P0YVJS4v0rxPu4Iq/gBE1BRcYH4MtkiTXflVlAxg5LSy+NWfGhUe4w/WsnbWS4cgKnFqmo34e/uD9Tn21eW14wmSno+PlF8VNr2FMdw4ffVQQm2TYwm7EOf8SQr5iAO/Nqu+qvKzx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-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: This series addresses issues in the zswap global shrinker that could not shrink stored pages. With this series, the shrinker continues to shrink pages until it reaches the accept threshold more reliably, gives much higher writeback when the zswap pool limit is hit. v4 is for cleanup and improvement in code formatting, comments, and commit logs. No behavioral changes have been made since v3: https://lore.kernel.org/linux-mm/20240720044127.508042-1-flintglass@gmail.com/ Changes in v4: - Updated comments and commit logs to clarify expected behaviors (Yosry, Nhat) - Merged duplicated spin_unlock() in if branches (Nhat) - Renamed writeback attempts counter (Nhat, Chengming) Changes in v3: - Extract fixes for shrinker as a separate patch series. - Fix comments and commit messages. (Chengming, Yosry) - Drop logic to detect rare doubly advancing cursor. (Yosry) Changes in v2: mm: zswap: fix global shrinker memcg iteration: - Change the loop style (Yosry, Nhat, Shakeel) mm: zswap: fix global shrinker error handling logic: - Change error code for no-writeback memcg. (Yosry) - Use nr_scanned to check if lru is empty. (Yosry) Changes in v1: mm: zswap: fix global shrinker memcg iteration: - Drop and reacquire spinlock before skipping a memcg. - Add some comment to clarify the locking mechanism. --- Takero Funaki (2): mm: zswap: fix global shrinker memcg iteration mm: zswap: fix global shrinker error handling logic mm/zswap.c | 112 +++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 82 insertions(+), 30 deletions(-)