Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp280002rwn; Wed, 14 Sep 2022 20:56:06 -0700 (PDT) X-Google-Smtp-Source: AA6agR4MOWg6hvl7uc5N2nu5vkKMo/t38yGikhj89esMiTAi9gkCuKxefyMQvm3hbtGTH7lR8XXw X-Received: by 2002:a17:907:9603:b0:742:9ed3:3af2 with SMTP id gb3-20020a170907960300b007429ed33af2mr27581262ejc.510.1663214166683; Wed, 14 Sep 2022 20:56:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663214166; cv=none; d=google.com; s=arc-20160816; b=jN3MD9VAz/xisLv2b1GQZV1SE9ov4EqUSyN15Uxn/hAhfgiNglOTLR4hs5M+kRJ8TH 83lnaZpm/44NAhOiEVYW+c8FfXKa7a/MGZqoKtORdgkUqVa5WiJegjuvz+dDEDZBRIdg fcLJp56esN+2HzoZ8jjE7lKSWtVDgdtW0UHVn+uMy9YwYCTya5Y89DPs4CZ4WE/fmBJo Dv14ROSG63N/EQRQGDFYCIzQ0XgGnXZbj7v6M55nIC+yuezAtyoUkhYZ6yLzlIlYlq28 q1HZI1a/ccPvr020S/5r83GO/RX49NxGtGJ4iUaGDcPdNrJeZOeuLxbc5GyAiyf5osNS VbcQ== 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=xEDOvvoJsh5qS8P0XRi3clUSEVkv7joRL3JwFAvZa0Y=; b=bJne9DgSRMAXM+VT/TrtvnuQhoIl59YZSOHB/Rm+U6pilo5MR791Opn4BgBSIP7JuX /bCZWuLlg4SB/+FPKPO7txAjhvUUKaNcjFK7ZBqzTjba/q2/9Rtj+hy+f1NCpKBs4sW3 U7XZLrPoYgDrlrheCHratBHJYsshpEaUWKzrEDEwaJZOKdNgEQhzLiw0elDgdXRn0LuP 7yeFoZ3QGUd7xqFDC6gCE+7HE8kEz8o4O+dra9s+dSlsg514StfatRuf58fw1UrTSv4o 3Pt3CLlCCMIIpUDSm0ZcHleZqjI9R3ls5EiTB/YNhc8USpvPHGbTJF0C7HcwbjNzzG+z Ab5Q== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g14-20020aa7d1ce000000b0044eca55b86fsi11753194edp.367.2022.09.14.20.55.38; Wed, 14 Sep 2022 20:56:06 -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 S230196AbiIODQR (ORCPT + 99 others); Wed, 14 Sep 2022 23:16:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229588AbiIODQL (ORCPT ); Wed, 14 Sep 2022 23:16:11 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 52DA28E99B for ; Wed, 14 Sep 2022 20:16:09 -0700 (PDT) Received: from dggpemm500022.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4MSj0L60j5zNmK3; Thu, 15 Sep 2022 11:11:30 +0800 (CST) Received: from dggpemm100009.china.huawei.com (7.185.36.113) by dggpemm500022.china.huawei.com (7.185.36.162) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 15 Sep 2022 11:16:06 +0800 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.2375.24; Thu, 15 Sep 2022 11:16:05 +0800 From: Liu Shixin To: Seth Jennings , Dan Streetman , Vitaly Wool , Andrew Morton , Nathan Chancellor , "Christoph Hellwig" CC: , , Liu Shixin , Kefeng Wang Subject: [PATCH v5 0/5] Delay the initializaton of zswap Date: Thu, 15 Sep 2022 11:49:58 +0800 Message-ID: <20220915035003.3347466-1-liushixin2@huawei.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.113.32] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpemm100009.china.huawei.com (7.185.36.113) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 In the initialization of zswap, about 18MB memory will be allocated for zswap_pool. Since not all users use zswap, the memory may be wasted. Save the memory for these users by delaying the initialization of zswap to first enablement. v4->v5: Rebase on next-20220913, the previous first patch is superseded by patch ("frontswap: don't call ->init if no ops are registered"). v3->v4: Revert three patches to replace previous patch[1-2] suggested by Vitaly. v2->v3: Fix frontswap_ops NULL reported by Nathan and add init for online swap device in backend register. v1->v2: Change init_zswap to zswap_init suggested by Andrew. Liu Shixin (5): Revert "mm: mark swap_lock and swap_active_head static" Revert "frontswap: simplify frontswap_register_ops" mm/zswap: replace zswap_init_{started/failed} with zswap_init_state mm/zswap: delay the initializaton of zswap until the first enablement mm/zswap: skip confusing print info include/linux/swapfile.h | 2 ++ mm/frontswap.c | 42 ++++++++++++++++++++++ mm/swapfile.c | 4 +-- mm/zswap.c | 77 ++++++++++++++++++++++++++++++---------- 4 files changed, 104 insertions(+), 21 deletions(-) -- 2.25.1