From patchwork Wed Jul 31 00:49:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takero Funaki X-Patchwork-Id: 13747985 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 BDBF8C3DA49 for ; Wed, 31 Jul 2024 00:49:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 24C736B0085; Tue, 30 Jul 2024 20:49:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1FB8E6B0088; Tue, 30 Jul 2024 20:49:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0C3396B0089; Tue, 30 Jul 2024 20:49:29 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id E3A866B0085 for ; Tue, 30 Jul 2024 20:49:28 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 649B31A016E for ; Wed, 31 Jul 2024 00:49:28 +0000 (UTC) X-FDA: 82398214416.15.31F021E Received: from mail-pf1-f182.google.com (mail-pf1-f182.google.com [209.85.210.182]) by imf11.hostedemail.com (Postfix) with ESMTP id AAFF640007 for ; Wed, 31 Jul 2024 00:49:26 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=Zcir+hIz; spf=pass (imf11.hostedemail.com: domain of flintglass@gmail.com designates 209.85.210.182 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=1722386939; 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=vzObc05aPc52UiOVMyTXImOoRUGXGrutktUE8jBFtBI=; b=ktJjI+RgwHQ8T8CNUbvFs3GVZOFZeuvL1UGII7B/I5UYi2H8uC6pgA8amfw9hOC4jcVTB8 wsRAELk1C972zZX+x8UgrQDmayMVL/kkyWZHzRhxW8UuzsT/qJfNZFJOuIc4pi7EGdUpHe oxOydWu/xVeW4rms6NIS8TrGOya6rWQ= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=Zcir+hIz; spf=pass (imf11.hostedemail.com: domain of flintglass@gmail.com designates 209.85.210.182 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=1722386939; a=rsa-sha256; cv=none; b=p97sAqKhcO62H4V/tvWCioTRDkYO5NFRsdeaGErJT20zfGiwqPRTGtUxA4kRYipXQlq5UP /5ffWFuplRkteFiStWPm2Gsl8+eP5zx/FzA8PSAl6Z5Ymi5zfqbZ2vEZF3qFwBJ0Djp4/2 AWanMwBGLa5uyURv3bMD5FPlAM0U5BY= Received: by mail-pf1-f182.google.com with SMTP id d2e1a72fcca58-70f5ef740b7so1251306b3a.2 for ; Tue, 30 Jul 2024 17:49:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1722386965; x=1722991765; 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=vzObc05aPc52UiOVMyTXImOoRUGXGrutktUE8jBFtBI=; b=Zcir+hIze3RiiGdTxnqW2H+EhVpI6VndXCwl8joIJjHWP12bBbhJ/ZfydE8Bmtywwn iFqQ+MEltTLvx1IZZfLvehYZ594inKepGtWLcbMULEoxcrQ8UfbXXvV9q28acOyL8QKi eBBqsDG0ng4M+8x56KD+M4Y8wN2vxIrSm4/Z/ecy+1O39ZBJGCUUZeBzh/0ck51rLNxl KdzGqyiZh3qTzvUkesTawl5YFp1nzrnw88Q8E/UlTBX/5dyXipoPWnjy88LXRGa1BCT8 sMDEA10JwKeKjoAsk5GngZFabtKodLxTkQnn90Zff4Yp1eJXSO3zkfSAuHm0fKDtZL8v xhPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722386965; x=1722991765; 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=vzObc05aPc52UiOVMyTXImOoRUGXGrutktUE8jBFtBI=; b=bROyY6+y6iwmuHTzpPJjRVG4Lvdbj/IL2bYWSbTyGSYS+FCvyhugJY9j4Jv1WK/oVz hnv7RRjD1p4GyqwfCnzQJnriwAmJXUTgL26Iq/ObMzqHzVFj3iPVppbqNO7UOStmK1C7 aC2Fblso5yphKmLewPxrrs6n/D04lDeGUBMd9IUA03oOUvKH6SgwItOiLXBpfObZNroG ghPq0XyeoCJvifk7KqlwKJa2MhTiN4YCM0eBXn/cRLc/NlkaxOfzfSwZh5JMl/v13qHw e5KBr6iw7JsKfOoSIS6qEudsL9ksNRSWy6sAkCgyGXvZFXwYLtDxJ1ek1zFnyJptzYaS 53Xw== X-Forwarded-Encrypted: i=1; AJvYcCXuFwrKTmSe/xe9jy3TJv5WaVu9LDT4BLxo0G71IEpEg9SpN/2weUMR+mIugXyqWnIIPClLOWiHx+NGPFINWzXtBJs= X-Gm-Message-State: AOJu0YyDQhLNOHHFyV3b1m+uU8ECxWLcmr7cFfhdK7buNV0M5JzV+dNo d1h13+Mz9r0aZ/Pj+WRKlduso3j+9VrJiPRuIz2Wcey/kri362dL X-Google-Smtp-Source: AGHT+IGs5mton0rDOBOv3LX32rVq+TkhuohKJ8C5I8UeYNXk4WRk9Y0rEBnc4Wg62q/x6Gx7QlPCTA== X-Received: by 2002:a05:6a20:2449:b0:1c3:ce0f:bfb2 with SMTP id adf61e73a8af0-1c4a12c5cd6mr16248745637.23.1722386965288; Tue, 30 Jul 2024 17:49:25 -0700 (PDT) Received: from localhost.localdomain (h101-111-009-128.hikari.itscom.jp. [101.111.9.128]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-70ead8837edsm9344745b3a.148.2024.07.30.17.49.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jul 2024 17:49:24 -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 v5 0/2] mm: zswap: fixes for global shrinker Date: Wed, 31 Jul 2024 00:49:08 +0000 Message-ID: <20240731004918.33182-1-flintglass@gmail.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-Rspamd-Server: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: AAFF640007 X-Stat-Signature: z1k3cbdwut9oiqgb7pdy97p918jt8bc5 X-HE-Tag: 1722386966-745826 X-HE-Meta: U2FsdGVkX18orxEw3IBKGgfZJMz2kyLYxRXZ0uw14N+dLHXdCPTU7yy8pnYUZ5hQfnSHiYtlx5bN4Ijr+RF7+HnpTIFBRVEubfNoQbGH/1pAOjERx7UuYW5kr1IdNiFhTiIqY0RT2fSBfHHKN1+htL9AGBYk70RLowgkZXdvRJMdYz3127vXm8AIfDJ4544gh8sNmCwFkZm+cOSNYZPLbdfovnLMtRMPnRbMaSz12yR4blkFCmfiuf/Zpi5Dr/fNb7pX2ASEJf3HhUPqkLhxn2otgKxLbKSTCD6Wjy+ZVPtSptCsuF0bC69mU0pV3CzN/UrUOB0yD+yi1zRDi0nqJLXigjacGrCKEh+9M1PNXphgUfr6T3ns0c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=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, gives much higher writeback when the zswap pool limit is hit. v5 is additional cleanup on comments I missed in the last thread, and adds Acked-by and Reviewed-by tags into the patch 1. No behavioral changes have been made since v4: https://lore.kernel.org/lkml/20240727230635.3170-1-flintglass@gmail.com/ Chnaged in v5: - Cleaned up more comments (Yosry) 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 | 106 ++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 76 insertions(+), 30 deletions(-)