From patchwork Wed Mar 22 10:20:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Shixin X-Patchwork-Id: 7020 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp2248371wrt; Wed, 22 Mar 2023 02:47:14 -0700 (PDT) X-Google-Smtp-Source: AK7set/0t5qHdikiqavCfbgvhATCYluSThndx7gHIeAICptE4x/bP/6Db/meoBJxP0nzs5I+eBBU X-Received: by 2002:a05:6402:c2:b0:501:c120:6e90 with SMTP id i2-20020a05640200c200b00501c1206e90mr5978805edu.3.1679478434654; Wed, 22 Mar 2023 02:47:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679478434; cv=none; d=google.com; s=arc-20160816; b=EkT9e+84vfoHBze9WsbKOVGJa07H5VjVJLu4xRszmedIn2upNDBNV1WNLijDHKJHEs 5okzV30HgoKGCi+F4Fi2IPgaHCh/3ZFI8IVMb0KBN947DgghK+Y/rka6mi/GOx/PUpKF aUmWDwRC/gM2Tsqb9auViVpqTAxY1jTOBXnplb+2KAjN5xTvjLqOQCweQJ3RSvXw7c4p XBnFFQXbMP44wolfSV1MgRO66f8/N9oqMlzC2aypUChmrZyvMLJ5qgajxJvBWpkgCkQQ ZCiyUxJpCCzuuUS1Nj/TSp7UZGHMGyld1O5/g942HLdSXVFjc8T+CWEH6430ipYUdVTH 9iNQ== 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; bh=pP2q28f07vmkKymfgR06aYMlcqowUlzm7VwJTvd0cR8=; b=EJXsxHTl2hf3nfHAQZdWZz40o8FnJ6MNqsCm0oYxGINbuD3v+VgTKobjBTmCMMPgja oik0SEw+1jObDE+pmjIqrMvxtf2ExBFTSxE0q42y4UaSgpbQdenuHytx2tXConxfK8fB ygCso/B4wYucjUZy+Pe20mPVITI/Ckv1i7/8Z/LWkqvfX3tg+A0ZEVDPUadqQYp8z72d uf/UX5rMIlV5pD45Z2MB/OFEY44qwhS9Mxtdhd9xxhVEHwp1qb7tX0lgHXGQ0s88US3k wr7A0xs8/g+MyMNKrZlvN/+yRXTZRdw+wRqh/pfF1ACI1eYfTh6g0IpXwk84M6hrE5lf BRBA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d23-20020a056402001700b005005c19f34dsi11459299edu.511.2023.03.22.02.46.51; Wed, 22 Mar 2023 02:47:14 -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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230122AbjCVJ3r (ORCPT + 99 others); Wed, 22 Mar 2023 05:29:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52358 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229839AbjCVJ3i (ORCPT ); Wed, 22 Mar 2023 05:29:38 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E3C75CC35 for ; Wed, 22 Mar 2023 02:29:27 -0700 (PDT) Received: from dggpemm100009.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4PhNSR3wVbzrW99; Wed, 22 Mar 2023 17:28:23 +0800 (CST) Received: from huawei.com (10.175.113.32) by dggpemm100009.china.huawei.com (7.185.36.113) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Wed, 22 Mar 2023 17:29:24 +0800 From: Liu Shixin To: Seth Jennings , Dan Streetman , Vitaly Wool , Andrew Morton , Nathan Chancellor , Christoph Hellwig CC: , , Liu Shixin Subject: [PATCH -next v6 0/2] Delay the initialization of zswap Date: Wed, 22 Mar 2023 18:20:04 +0800 Message-ID: <20230322102006.780624-1-liushixin2@huawei.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Originating-IP: [10.175.113.32] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpemm100009.china.huawei.com (7.185.36.113) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-2.3 required=5.0 tests=RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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?1761060778817633785?= X-GMAIL-MSGID: =?utf-8?q?1761060778817633785?= In the initialization of zswap, about 18MB memory will be allocated for zswap_pool. Since some users may not use zswap, the zswap_pool is wasted. Save memory by delaying the initialization of zswap until enabled. v5->v6: Simplify the code and delete the patches about frontswap suggested by Christoph. Liu Shixin (2): mm/zswap: skip invalid or unchanged parameter mm/zswap: delay the initializaton of zswap mm/zswap.c | 60 +++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 50 insertions(+), 10 deletions(-)