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: 13021238 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 CFF4CC38A2D for ; Wed, 26 Oct 2022 20:06:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2D1668E0002; Wed, 26 Oct 2022 16:06:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2817F8E0001; Wed, 26 Oct 2022 16:06:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 14AA58E0002; Wed, 26 Oct 2022 16:06:16 -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 ED13F8E0001 for ; Wed, 26 Oct 2022 16:06:15 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id AFEFAA0240 for ; Wed, 26 Oct 2022 20:06:15 +0000 (UTC) X-FDA: 80064182310.20.EA9640D Received: from mail-pg1-f170.google.com (mail-pg1-f170.google.com [209.85.215.170]) by imf12.hostedemail.com (Postfix) with ESMTP id 4F0A24000F for ; Wed, 26 Oct 2022 20:06:15 +0000 (UTC) Received: by mail-pg1-f170.google.com with SMTP id g129so14377696pgc.7 for ; Wed, 26 Oct 2022 13:06:15 -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=NA+xzG4U3zMDHVyVQ/U6o+qNcd9Lay2bFHS11W8WFnOucVFYX9gLNif2tLYDIHQZLR airye0rKDUmv0J2ac2wP/2aQz6CNrL4zyxjMmoNBMHxZkSxtNLG6sdq+5DunoQbQ1Gyk oHoMCbqqB7AWkz5q7vRym/rSoUQmrCt5cshnGcC6qEgBQ69qrQt3xmjuFD9BuWR0dZPa SLJv93CoSyn9Er1jRHnocTVPLMhSQQO4UV521iCFQs7nkB8N74VWPlBsi2HE2ymlyLIv y8mXtQy+hkdGfMyjSkiDmfU7OirvX4WlQ3Reoj94IBHOWx64XpfNdiPcVFZONZvA91AF rwiw== X-Gm-Message-State: ACrzQf1IQQzumYroNPk6N3CW+x74qzIbJdBd2/IyLq9WABp082P+JPId ZE1QmXEoceERePEH1NSdaa4= X-Google-Smtp-Source: AMsMyM5QuZrhcCnyRx3su7R58u0nee6W0dVwUX1JfGG1ey4UKXMlqlErXifS4buOqGUUdXFb/d7cbA== 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 ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=aBtyYt4P; spf=pass (imf12.hostedemail.com: domain of nphamcs@gmail.com designates 209.85.215.170 as permitted sender) smtp.mailfrom=nphamcs@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1666814775; a=rsa-sha256; cv=none; b=qTfDFq/JEhw2espMEg1SuxGrvt2e2375uRA1bepJirhBAp8MNcMvEotUdn1gOpZWXGUHD+ ReJ/XsJs2ZzyGRkZg1gu6wpzSW4a5GW2YccjJ+lBjngpsNeGhz9VshPF4zhjh6M+0GU111 r3v651ERXoTTp+g2eT8Kvu/JSQPSbHw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1666814775; 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-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=reYTGbFPdclPcD2z+9ilEBAxZuR3E49Fi6l8bS5z4WI=; b=WkRY7ZhcWAdclCLfVEs8GjQmUvP4p/YzMrsY7t0zIQMfn991/ww7ZP9NQxMpTnkqVOLE8/ /yhNapOKdAqXJ9CXdRAKs1UxBIlqSU3L+a1CF0bB3L+VYzT3T1bblOsmRAQnk4bOGtHUGe VuqWI+zFNAbkfGehQovbZU60bEwFbKU= X-Rspamd-Queue-Id: 4F0A24000F Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=aBtyYt4P; spf=pass (imf12.hostedemail.com: domain of nphamcs@gmail.com designates 209.85.215.170 as permitted sender) smtp.mailfrom=nphamcs@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Rspamd-Server: rspam02 X-Rspam-User: X-Stat-Signature: ecun6jjwtbngms81cexasgohz34ohh3k X-HE-Tag: 1666814775-871459 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: 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