From patchwork Sat Jul 20 04:41:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takero Funaki X-Patchwork-Id: 13737608 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 2C787C3DA49 for ; Sat, 20 Jul 2024 04:41:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 64D2A6B0082; Sat, 20 Jul 2024 00:41:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5FD9D6B0085; Sat, 20 Jul 2024 00:41:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4C44F6B0088; Sat, 20 Jul 2024 00:41:39 -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 29B996B0082 for ; Sat, 20 Jul 2024 00:41:39 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 5FEE31C1CAD for ; Sat, 20 Jul 2024 04:41:38 +0000 (UTC) X-FDA: 82358882676.14.21A09D5 Received: from mail-oi1-f170.google.com (mail-oi1-f170.google.com [209.85.167.170]) by imf01.hostedemail.com (Postfix) with ESMTP id A327840017 for ; Sat, 20 Jul 2024 04:41:36 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="R0+TCI/F"; spf=pass (imf01.hostedemail.com: domain of flintglass@gmail.com designates 209.85.167.170 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=1721450439; 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=TazlOyBq9n8e3ZgcH3KBbY9Dk+2vyIhBQceuB/M1KFA=; b=qhM0PtbkQBaq+yRD57QCEKBqE+2mo5Ka2rf4DNN+4Nu5mkuQqr06LzOo/C7tDNGjxNgPO7 uBgGjGGQJ8+1Bf2zsZ6zuwsYG4AY0NFKjZr8xOzZ9jr/AdtzCMR2gDInyvwZKep8CI2xxZ O5lZ+j2DUYLetBLAfpDwnJwYl4kx3Ek= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="R0+TCI/F"; spf=pass (imf01.hostedemail.com: domain of flintglass@gmail.com designates 209.85.167.170 as permitted sender) smtp.mailfrom=flintglass@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1721450439; a=rsa-sha256; cv=none; b=T8L2QMFWu0X6sH8MG1zwXfKPXLLOQcpb1hJloBG+UsqGaNT5HXhm8xYZmKLnuat4WN4cmT MQLQrSYg4qUX65kS57dIS2eD76sNvh3Ztp7+DXZcuONVNoZ/qho3n7b3VXrLRcoJlPK8AD +VrJnq9MsD7YUuF7mkX8yCT7azMKMFU= Received: by mail-oi1-f170.google.com with SMTP id 5614622812f47-3c9cc681ee4so1390162b6e.0 for ; Fri, 19 Jul 2024 21:41:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1721450495; x=1722055295; 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=TazlOyBq9n8e3ZgcH3KBbY9Dk+2vyIhBQceuB/M1KFA=; b=R0+TCI/FHQCJkEUFDZ0OlHC8PONCZ319LSv9cXB7kWPt+mMbVXAQvLEY4KMicQEx11 DM080DSlXX3Yo75wsYmtAuzc5SbzYOKwIbcOVCICfsxRiMURo1ciFM8pPjB584OKQP2W ZRDlp2OLN5mgQoAE8XhEUKN5R8FD35OJtQK052SiwOsfs1iVX2ipoIURn1OW3K+HEJGS n9k0UdkYMhrxuXiQXpy7RVf7JulgrNXanz3GlFh8g3GzV3ku3plEYjgQsE3ibkfuqXm0 E4dvekwYTkj9i8Pcaf9s3x14qDxMrE2ArsrAhZKvFThsskLdxKsbPPWsFEUqxWSnpKE6 VLGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721450495; x=1722055295; 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=TazlOyBq9n8e3ZgcH3KBbY9Dk+2vyIhBQceuB/M1KFA=; b=UaovHXS85/YMnRhc8vHBzYdzSEgNSVE6rLCjq7hbTMtdyKqcswwZ68aZnK0AOXax8X RcYHQGXw424ZHXKMY3GodhpbJpb7EUsiIsKpDFzYcEtj1XzUODinKs6fLEm1jDo0+yN8 vcdBTkcRxZ3J8xwZnP+Tf4Jb98rf88Cmhfgpg5IHcjEo5hTddznECJW6RVkB9qtcWCdQ TmerT6TIBD7vqAfFvcEBxK1hCx4SbIklw5e8/vVm27vD4zhNAbFgKdKTxPqULqeJwfQk 0FITCnCsvsjtcsTvOWr53Z5e1+iMvyRUZtR+XzNN6xaDw3iueHFzBuKwgdmwg2JOpTgj zqfA== X-Forwarded-Encrypted: i=1; AJvYcCUF81CZoxFLTk85N1nzLfqCXzXnsXzPhQp0KPRQL54QxhYVVZMLmAUzzkYLmKtvuTd7EHwITcG69n3XytBw+9oNhjY= X-Gm-Message-State: AOJu0YyyvIo1ZosQL3zD+wu6fkhmpKsJ3lP+YDSRg3yV1XAXop8IXpCX IvPMipJQ4xoHe1N/U4uk7OzA/dHqy1JMZh24RA16cl9Z0ckSmMKP X-Google-Smtp-Source: AGHT+IEQTgYsXPO4r/PNUv8ffc7ODyfYPBm5tDS4j4swPzpIs3ZqD+AJtllRuvQV+fjq4BAIx5ShFA== X-Received: by 2002:a05:6808:1a01:b0:3d9:2562:7541 with SMTP id 5614622812f47-3dae62e9898mr1980921b6e.24.1721450495625; Fri, 19 Jul 2024 21:41:35 -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-1fd6f315c11sm13023465ad.125.2024.07.19.21.41.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jul 2024 21:41:35 -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 v3 0/2] mm: zswap: fixes for global shrinker Date: Sat, 20 Jul 2024 04:41:23 +0000 Message-ID: <20240720044127.508042-1-flintglass@gmail.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: A327840017 X-Stat-Signature: kjczj8ggyot8u9jgm5745r4tkbbx8prp X-Rspam-User: X-HE-Tag: 1721450496-751194 X-HE-Meta: U2FsdGVkX18hhsxBkmwCrWZV0ZkqLxiJE9KUbw8PmwlvZGIgriIc+f3QmA8OBGI0pxllgc91JlWUDSQuNyGo9/ygtVknqKgms6r4ell/HhSZ9rKhwPnN8kp8zVBPSzNn+eCYlniNh50BWcNT1aTSlt9/XDzfbGUSIEaYC3weRQaN0QZyGgiPVnIfB8F7MgYCFFDfZGVoAiFd5Uukbu/L+1OQvRVRUF3sjtojwW4ffJDzh0/nFx6eOPQMiSMZjoAWa8nx+jxK3eOiWzGSlXDlw9XCmaXoh16yUzPzrvzI6bSlFeQMLVk7GFJNpskOSKyPpRwlbTnxfLwBTFB2MTzmBijd7/Va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, 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: 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. These patches were extracted and updated from the original patch series v2 (mm: zswap: global shrinker fix and proactive shrink): https://lore.kernel.org/linux-mm/20240706022523.1104080-1-flintglass@gmail.com/ 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 | 100 ++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 73 insertions(+), 27 deletions(-)