From patchwork Wed Oct 26 20:06:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Nhat Pham X-Patchwork-Id: 744 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp462919wru; Wed, 26 Oct 2022 13:09:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM65G66XrdvoDRASW34I9NOpNU41a9+mss9EeLUFRmCd1MSeeh4CiMbQYm5L3sLkl/roErH6 X-Received: by 2002:a17:902:e80a:b0:184:6043:752d with SMTP id u10-20020a170902e80a00b001846043752dmr45405493plg.137.1666814981392; Wed, 26 Oct 2022 13:09:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666814981; cv=none; d=google.com; s=arc-20160816; b=Wu5d+j6hWvL1QhLzOVLpSRyi9Ml3HIEh2NypQMTKfeN+ALYpmcVaI/ezLX8nCPFjNs 79Qo8WqQAmB+hGA260jR4pvUVdIbM4saxJacmmxxU0P/oArfcrZAXLJRMmc1woGJDoFx AOX3KP8nUJrxTZpDjrfUe0AJgZujF1kH/1MkMhKJlunBgxEbCnZ3uzziwqaQ+sJybEYT nkEWgOwNuRX0dvWM2jXbyD2XbLyDasJLoH/sx9BbdEUqVju6lo4E6BoIpenP4iVy6bLt RM4ZrXqgSN+H7vJT6IfRqaOXi6ovVoqr86Prk+l2Gcli7q03DBL8FFa8sw0xEqTqgffz Zq5g== 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=reYTGbFPdclPcD2z+9ilEBAxZuR3E49Fi6l8bS5z4WI=; b=Cr/KAEvw1z8z9EK7c5icgmDRuey/e8w3j+SUgc9Zi0tZhhXrYjFXKtL9yLRwQ8tQ4D +rX5rOpM9Q8aH4ei3wSQIrvM6vlT2wipvK/K4V+6z8hJyckWH9fKk9smYLCensvUXRo7 /8L669eJtnLZeiEEdjKlFibPQ1Y+8UuavnZjvBacBB8Mw73XImB2jcEXRygchZ6kkixp jHjwaPaqCejlOZs5qeK0kgPNEhbhV2etK0FZYM7E6PN9lUp6oJ501NgSCcxaPjJynDFe sUmTBGJOHzuwGReoPKB3QX5eH92XnvLjc44XjCEGHYYAVtuTgsdj/JYjoCnOjgzrQcEw 8eCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=aBtyYt4P; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mh1-20020a17090b4ac100b00212d5631badsi3901154pjb.55.2022.10.26.13.09.23; Wed, 26 Oct 2022 13:09:41 -0700 (PDT) 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=aBtyYt4P; 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 S234410AbiJZUGx (ORCPT + 99 others); Wed, 26 Oct 2022 16:06:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235014AbiJZUGV (ORCPT ); Wed, 26 Oct 2022 16:06:21 -0400 Received: from mail-pg1-x52b.google.com (mail-pg1-x52b.google.com [IPv6:2607:f8b0:4864:20::52b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B83A7923D4 for ; Wed, 26 Oct 2022 13:06:14 -0700 (PDT) Received: by mail-pg1-x52b.google.com with SMTP id 20so16023882pgc.5 for ; Wed, 26 Oct 2022 13:06:14 -0700 (PDT) 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=reYTGbFPdclPcD2z+9ilEBAxZuR3E49Fi6l8bS5z4WI=; b=aBtyYt4P+vrjfIes9GrPnp95ytz1pJMQqoVJ9IaOTyatT7BoXUjWDPFe7pG+Lk4T79 NQuMNp02jNFbg3gNY3A6L5qaM0I+ipLR0tic74LTR25pkvpbJp07lDvXeYm6xmOtG/BH op+IP2TMH34vf4h8sRylM7+9xt8LxOPbRNiyKSalamzvKDJEYWNI1aILFBGmb3njkqQj nmHPjxnsNzYpDqpjCzaSPqJSK4Jb7RJzZna4H+HWIdBQVl05zEPXIXq+Aztx7KiAF66s k+AD9Z375sO6Ti0vlaZIne8oZPdVrcblEhURsgaKd+UYVIlFWZLvTrt9geLhnDGjsBya qkKA== 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=reYTGbFPdclPcD2z+9ilEBAxZuR3E49Fi6l8bS5z4WI=; b=g17CQlYUj87ZvGfxnR4Ggtbn/xGNAZ35MqCyIxtZUPYNqL/cM896Fr/LHZ8dFQvMwu 0ALNGrmL75k+FvEb+S7wx032e0Z/Bv2PUjW+O9DIppfd31cBtb0DJPB7gVRGzGFEn4So Ti7bCt/MKNcIXqtMnRr1BpAatQWm6p8RyHlXnjivvOGJwIoKdqbK3Ogc9jfrKnmgBlv8 StxSJ6Zs/IME28BdomXU3HZz5ERe9Oel6z9urLdraRBektmzmjwUJ2RfyWda3+6eZM1b oYM2v3C8nljFrKgJEowZnK+sCTGQC9pfs4gG/s3rfcccvvpkuXpmA6e88D6yjAd2ROxH 89pw== X-Gm-Message-State: ACrzQf1o0QVDmCU/XiavTmd26/XWIF/OBzUzgzYgUeW87Pp8u4uAGK8f /zVwq3eJCHQfe4AmeE4SU78= X-Received: by 2002:a65:6bd4:0:b0:443:94a1:429c with SMTP id e20-20020a656bd4000000b0044394a1429cmr39156742pgw.606.1666814774292; Wed, 26 Oct 2022 13:06:14 -0700 (PDT) Received: from localhost (fwdproxy-prn-003.fbsv.net. [2a03:2880:ff:3::face:b00c]) by smtp.gmail.com with ESMTPSA id q15-20020a170902dacf00b0017c19d7c89bsm3296439plx.269.2022.10.26.13.06.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Oct 2022 13:06:13 -0700 (PDT) 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 0/5] Implement writeback for zsmalloc Date: Wed, 26 Oct 2022 13:06:08 -0700 Message-Id: <20221026200613.1031261-1-nphamcs@gmail.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747782185750631501?= X-GMAIL-MSGID: =?utf-8?q?1747782185750631501?= 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 | 336 ++++++++++++++++++++++++++++++++++++++++---------- mm/zswap.c | 37 +++--- 2 files changed, 293 insertions(+), 80 deletions(-) --- 2.30.2