Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp4065539rwb; Tue, 8 Nov 2022 11:35:42 -0800 (PST) X-Google-Smtp-Source: AMsMyM45nteALi93FMeAgxxhM7eJ0LEVG/siEogSoTJSk3GmJDsJ4dYb2o+9Dkf7Z+K/2yooX89Z X-Received: by 2002:a05:6402:440c:b0:43a:1124:e56a with SMTP id y12-20020a056402440c00b0043a1124e56amr58791670eda.134.1667936142496; Tue, 08 Nov 2022 11:35:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667936142; cv=none; d=google.com; s=arc-20160816; b=WTITeyQvZ+IvOpBBfWcGKw7G6j3zbNI8SN1tf1l2kGMUIl+LD0+ra2oh2BUaH8iQum g+qdI2HnBmAoSURrKJ+V9fqxtNJgkL+S0qDBFiS57abcd5TKiF+VKXrcCdvGClbzkk4C Tb+te8ysy6xDXPiSCpZMbcQvt1g/8I29sLMXNmX6WFNRkqOq+9CjORudQCwM0lCv3IBG D0Nq+X1ByJiVTN+x/s+hyl6XRrU2ORTh09US8IwyyCplQ8Qmb3coGQhd2PxkeXaiC5Z7 uLIbDDsBAotQWwF5D9PtrLjqNoCdqP9K0MbJ1q41PBpXJyjrPoTvbWpKsyoBw4QM0Ypz BIOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=/fmsZ6yPuBdWLDut9uV/WRXSBm+/VHvg2djO9W463cg=; b=omEcCEfPcXATBsPxtfhVEswCfBwmNz7yx5W8htjOL5rCTYigzlqXCewURJ2tq/vU9Z AGoYL5JiZ5FCxhpDri+yhM3K/2/tC5E2uGThdsxF5ze6yi0MEtr49XV0+NILPGQL3veS vALuLDTwdYtprIaC2M2xOhj3nYcgSRmLrBUkKb3xSScjzqYTIvemWdoBJyAejWUa/wZo h3a9LcIKBJ+DgoUCAMbpuSSjFogr2BIVguJGCy/feCd9FyWJj7qeK7VeHXp4xcxsWL8A p9kc/xm5Sx6S6xK//ETnqT9jH3oJfC5ZZEY2kKTkkyS2WC6zCW9xofeJRrErX7mpYkW9 JIcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=IMAaWFuK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i8-20020a1709064fc800b007ae83c51922si1906613ejw.45.2022.11.08.11.35.20; Tue, 08 Nov 2022 11:35:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=IMAaWFuK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229566AbiKHTcL (ORCPT + 92 others); Tue, 8 Nov 2022 14:32:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229447AbiKHTcK (ORCPT ); Tue, 8 Nov 2022 14:32:10 -0500 Received: from mail-pj1-x102a.google.com (mail-pj1-x102a.google.com [IPv6:2607:f8b0:4864:20::102a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C639C66CA8 for ; Tue, 8 Nov 2022 11:32:08 -0800 (PST) Received: by mail-pj1-x102a.google.com with SMTP id o7so14729947pjj.1 for ; Tue, 08 Nov 2022 11:32:08 -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=/fmsZ6yPuBdWLDut9uV/WRXSBm+/VHvg2djO9W463cg=; b=IMAaWFuKFcdE6LFTCDhevmWnDnKjOGMzE+wgopbdHEH218c5ommJirHhEKylMJUDIA iT292IbLb/clBh8CvHU0ileiPa59zhyUrnHtX6crGjDqH+DjJ6GhxjVnsx1LrH9coV9N MlLh2PiPaQOEO+bvvvuYbcJNgnvihUrrTg1aOPXm/nH6Oj0VWECb312Ri9KUnPUFb17U CLqDGl257cKfAWwSThX/muWWmMAvghVvWhZ/cMKPaKOiwYViDzM2EL4a1fAch6c0WMdR 0nBwj91j0CYADx2/IOwtKuv263DON8uk9FwOqYrMQ/AQ0BEZ4Y/HO+jsNQzoBB1o0Q9c wvxg== 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=/fmsZ6yPuBdWLDut9uV/WRXSBm+/VHvg2djO9W463cg=; b=REQOcyhaUuxDkD2MKBBApztb72sn6y9k6KERGgWZrdhqeYAnYOdHTjO1JIWXxiN0tF 9908bkHu6ehQ7jt9xvAVWM74ehe6tEtcjxURBtwggsMvwM28kzCANjQkedXzMyi45gcH cHTeJSYvKE1ydnGUDMrGXs/4yeEqBxhA1aaLmYS5BfE2JrhAMt7mhsr3H/gmP7aIrUWU RWsGxOmsxymvyA23QHX9i0NXPVO6YacaValjTG7sbPi1i0JMW1b+h/Azs6wzEY8crf7E BmEZB16hcyDybuFe5BCt24wra3A7CENz3SZXJE9bu3AnVBEHS3qZyZb6z03Uzh3b1Tl/ iW1Q== X-Gm-Message-State: ACrzQf0PfBmhYUB+25NwZIS3/VtX/x/8wu117+lLjsfHBPi96y/bTKsA 1JMN/WEM/f6caCwbfLfO5uY= X-Received: by 2002:a17:90b:3705:b0:212:e2e5:c0c0 with SMTP id mg5-20020a17090b370500b00212e2e5c0c0mr59748756pjb.239.1667935928316; Tue, 08 Nov 2022 11:32:08 -0800 (PST) Received: from localhost (fwdproxy-prn-023.fbsv.net. [2a03:2880:ff:17::face:b00c]) by smtp.gmail.com with ESMTPSA id k4-20020a170902c40400b001869581f7ecsm7373877plk.116.2022.11.08.11.32.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Nov 2022 11:32:07 -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 v3 0/5] Implement writeback for zsmalloc Date: Tue, 8 Nov 2022 11:32:02 -0800 Message-Id: <20221108193207.3297327-1-nphamcs@gmail.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Changelog: 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 5 patches in this series: Johannes Weiner (1): zswap: fix writeback lock ordering for zsmalloc 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 ops fields to zs_pool to store evict handlers zsmalloc: Implement writeback mechanism for zsmalloc mm/zsmalloc.c | 346 +++++++++++++++++++++++++++++++++++++++++--------- mm/zswap.c | 37 +++--- 2 files changed, 303 insertions(+), 80 deletions(-) -- 2.30.2