From mboxrd@z Thu Jan 1 00:00:00 1970 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 BA4CFC4332F for ; Fri, 18 Nov 2022 18:24:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E912E6B0071; Fri, 18 Nov 2022 13:24:10 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E1A9F6B0072; Fri, 18 Nov 2022 13:24:10 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CBB226B0074; Fri, 18 Nov 2022 13:24:10 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id B81216B0071 for ; Fri, 18 Nov 2022 13:24:10 -0500 (EST) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 8C5B7AB97D for ; Fri, 18 Nov 2022 18:24:10 +0000 (UTC) X-FDA: 80147387460.26.4B53E32 Received: from mail-pg1-f176.google.com (mail-pg1-f176.google.com [209.85.215.176]) by imf18.hostedemail.com (Postfix) with ESMTP id 38F9E1C0011 for ; Fri, 18 Nov 2022 18:24:10 +0000 (UTC) Received: by mail-pg1-f176.google.com with SMTP id v3so5692268pgh.4 for ; Fri, 18 Nov 2022 10:24:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=6E6GpRuxKdp+o4hP203uhjB5+UZzDZfAaY7rEhcjmoU=; b=dgQqcKyOimQp9XMKebGUyN62bGP1UyhSB1dXOIepkhFhQ0u7EuSIgK+z8cl7HS0+ax EqjZZK1zIob55ymdYqhT4IwS7jEI8Yeh0p9KpRYMBIqts3w/93LM7KdqmxEccD1GjB0/ ruUhKy7pFSb+aul93ooT1CmBJg7TjTKLBPA9SnHqaellRHZbJ+9aPHmTieZMt0Aa+N90 1tbhlT0FU6eSn3xTFq7s9fGhTR/ToyRuCe+zP4quCJ5KU4E/4WlTNSheFhu0kfEyKnRB zUueRTftg+8PW0Egi+dD0SaWA7Ydcn2IH4geFv5val8I4nMWaNzp9QjMDd+l0dariIM8 437g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=6E6GpRuxKdp+o4hP203uhjB5+UZzDZfAaY7rEhcjmoU=; b=Qs/ZHtAuY81nqqamrke4HsR9inIbACbzi16DSAy7XNmxwYAUsWK83fwunm07xTuDVN 6n8UFO7YP5Fv3f4zJ9RKdXv1xxzk57o53wAACUF2XzA6D2FaVquFX34S+yivQaewAgSY VLdG054ppt805XpsWA762FYMNzLfZMYLNvQPvxh3zfL00mkXSL+PNfeBARIEy4WQnpuE g3D1zgaNC58ptaxvwZR43EIWApjKLVTud8qQCbgXjFCdFbtNL47nCsPaGMwhfsSJ+YHS uW6qio3hYR6DCwdFuFVLZHrf5Dkt7uhI/SOxe5uBw8LEXy9wcJUS8JjVGrTjqkbKMEyX hbxA== X-Gm-Message-State: ANoB5pm0wADijSRMbGSzhWRYE9H1ma/MmBih96jsg2/Mj5OTSZzSLycR b8zwe+sYoH15ZMkwxt2KvPY= X-Google-Smtp-Source: AA0mqf5zgsVV7oRh+CV3HKJU4wUgwbbvSp/lEnKSpxJnGLy1BHF55AFr3NEynmec+wCEg86cArFiFA== X-Received: by 2002:a63:fa49:0:b0:476:f92f:885b with SMTP id g9-20020a63fa49000000b00476f92f885bmr7784709pgk.31.1668795849138; Fri, 18 Nov 2022 10:24:09 -0800 (PST) Received: from localhost (fwdproxy-prn-005.fbsv.net. [2a03:2880:ff:5::face:b00c]) by smtp.gmail.com with ESMTPSA id d10-20020a170902654a00b00188fcc4fc00sm2304255pln.79.2022.11.18.10.24.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Nov 2022 10:24:08 -0800 (PST) From: Nhat Pham To: akpm@linux-foundation.org Cc: hannes@cmpxchg.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, minchan@kernel.org, ngupta@vflare.org, senozhatsky@chromium.org, sjenning@redhat.com, ddstreet@ieee.org, vitaly.wool@konsulko.com Subject: [PATCH v5 0/6] Implement writeback for zsmalloc Date: Fri, 18 Nov 2022 10:24:01 -0800 Message-Id: <20221118182407.82548-1-nphamcs@gmail.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1668795850; a=rsa-sha256; cv=none; b=T+RjcFc0JI3ZAqTT7HEcdWJlx5wxzfSsZcrlw4v5ZQjFLbMKpmU1/rYXI69X5OhSy6P+JM Q5t4Uaquc10ju7xzIP6Lj49yAwbMakDF3KAI2tGaIofypvHtLGNiZDWwwrElyeSu5wODF+ Rw3+iYI8BtkMuAeL5OkCKw7JDb+4A5s= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=dgQqcKyO; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf18.hostedemail.com: domain of nphamcs@gmail.com designates 209.85.215.176 as permitted sender) smtp.mailfrom=nphamcs@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1668795850; 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=6E6GpRuxKdp+o4hP203uhjB5+UZzDZfAaY7rEhcjmoU=; b=01iI/avJQC6EhD+cCzO0Qfm72V6hurHG37IzqN2CrKgjOnch9BHaH15KKSMSi8ra78BU84 zYdoirgum/GOhUHTcCL2pucuaEkg45udl3XHrDLTv9djC1iVCBqPxPoFvGmKXWz3Kew132 09nkAW6PFoT649cHvN7lto9fGrkmHB8= Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=dgQqcKyO; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf18.hostedemail.com: domain of nphamcs@gmail.com designates 209.85.215.176 as permitted sender) smtp.mailfrom=nphamcs@gmail.com X-Rspam-User: X-Stat-Signature: obpkfdg77mj9mbfq3s7ncf9jfttdg7qh X-Rspamd-Queue-Id: 38F9E1C0011 X-Rspamd-Server: rspam11 X-HE-Tag: 1668795850-111545 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: Changelog: v5: * Add a new patch that eliminates unused code in zpool and simplify the logic for storing evict handler in zbud/z3fold (patch 2) * Remove redudant fields in zs_pool (previously required by zpool) (patch 3) * Wrap under_reclaim and deferred handle freeing logic in CONFIG_ZPOOL (patch 6) (suggested by Minchan Kim) * Move a small piece of refactoring from patch 6 to patch 4. v4: * Wrap the new LRU logic in CONFIG_ZPOOL (patch 3). (suggested by Minchan Kim) v3: * Set pool->ops = NULL when pool->zpool_ops is null (patch 4). * Stop holding pool's lock when calling lock_zspage() (patch 5). (suggested by Sergey Senozhatsky) * Stop holding pool's lock when checking pool->ops and retries. (patch 5) (suggested by Sergey Senozhatsky) * Fix formatting issues (.shrink, extra spaces in casting removed). (patch 5) (suggested by Sergey Senozhatsky) v2: * Add missing CONFIG_ZPOOL ifdefs (patch 5) (detected by kernel test robot). Unlike other zswap's allocators such as zbud or z3fold, zsmalloc currently lacks the writeback mechanism. This means that when the zswap pool is full, it will simply reject further allocations, and the pages will be written directly to swap. This series of patches implements writeback for zsmalloc. When the zswap pool becomes full, zsmalloc will attempt to evict all the compressed objects in the least-recently used zspages. There are 6 patches in this series: Johannes Weiner (2): zswap: fix writeback lock ordering for zsmalloc zpool: clean out dead code Nhat Pham (4): zsmalloc: Consolidate zs_pool's migrate_lock and size_class's locks zsmalloc: Add a LRU to zs_pool to keep track of zspages in LRU order zsmalloc: Add zpool_ops field to zs_pool to store evict handlers zsmalloc: Implement writeback mechanism for zsmalloc mm/z3fold.c | 36 +----- mm/zbud.c | 32 +---- mm/zpool.c | 10 +- mm/zsmalloc.c | 334 ++++++++++++++++++++++++++++++++++++++++---------- mm/zswap.c | 37 +++--- 5 files changed, 303 insertions(+), 146 deletions(-) -- 2.30.2