Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp3107918rwe; Mon, 29 Aug 2022 06:04:51 -0700 (PDT) X-Google-Smtp-Source: AA6agR7Wx3cA+fSFH1FEfdh0ou0wDq5jg6jiCA/CyMio6iPyzXhohCXAvRWrFn5SfKNE5ttYGZ9X X-Received: by 2002:a17:906:ee8e:b0:730:4a24:f311 with SMTP id wt14-20020a170906ee8e00b007304a24f311mr14061707ejb.420.1661778264126; Mon, 29 Aug 2022 06:04:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661778264; cv=none; d=google.com; s=arc-20160816; b=eKPiQWMC7/Vm6FKE5BuPn3XK05oSQmi1ApSOTTlxzXqyEn7Nk7IFLGHnCyVWZ3t+/t r8V0cN00IXId4HfFhyGOPqdrMewae1fzNMEDf5tjoDUvRdhtwMWIGHAkOY5wNN249AvY Mz9N9atYHFfUthmZyyV+G+w/P1lvogCH174oSWJyi8b1w6h7JIR4KvkwnACcCNARDxlf XhNSlT+VqznOmppbKfyD7XfHEngB9FW6V4RDNHy5duqKbWZ0g2E74i/zL8sX2s3DuyV+ CA3h15qffTcYRp1PHoq6QKSOmbH+wJkL5sXYnq1z/jvJ4IJpjHhTwi7A5oZsrpFBiegJ wq1g== 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=Bzs60Hpc3is6lp7YzGaH4IU3xzLub7mijgFqU5gppUA=; b=X7xrrd5BnL40OVfRZGxbMBQieMzERTo7PgMcjV8ay4oqod2TftP/VxuIYyHYdHwgQk vOgT+NSx6SPfDuLm91hZqIMRMCT8cQM5wB4IVDt1EoEsEgZP2TpvSjAYyV0TeQel3/T0 3tSRtZ8BfBWpcziO5IbtU0ds91jjwvK3wMMtw+4eh8NTq72D2K0/2CaUOIrMHM6V4FE1 SS8mFoAedraKr+tY7h3Tn1BCeCpTK9moGbAFCEQzemI5f1BQ/17wqV+7nS/zyoMXKISb IQmAoVS0sNMj8r+GuVkGA6xS6AUdx7mVRCokLh2Yz/AXha6AC/Tn1OTRZvoho20xbu8s UUEg== 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 q11-20020a50cc8b000000b004467c12a6bdsi6695052edi.459.2022.08.29.06.03.58; Mon, 29 Aug 2022 06:04:24 -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 S230473AbiH2M56 (ORCPT + 99 others); Mon, 29 Aug 2022 08:57:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50182 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230308AbiH2M4g (ORCPT ); Mon, 29 Aug 2022 08:56:36 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2222CF5B1 for ; Mon, 29 Aug 2022 05:48:36 -0700 (PDT) Received: from dggpemm500020.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4MGVVz3fFGzYd0m; Mon, 29 Aug 2022 20:44:11 +0800 (CST) Received: from dggpemm100009.china.huawei.com (7.185.36.113) by dggpemm500020.china.huawei.com (7.185.36.49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Mon, 29 Aug 2022 20:48:33 +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; Mon, 29 Aug 2022 20:48:33 +0800 From: Liu Shixin To: Seth Jennings , Dan Streetman , Vitaly Wool , Andrew Morton , Nathan Chancellor , "Christoph Hellwig" CC: , , Liu Shixin , Kefeng Wang Subject: [PATCH -next v4 0/6] Delay the initializaton of zswap Date: Mon, 29 Aug 2022 21:22:56 +0800 Message-ID: <20220829132302.3367054-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. 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 (6): Revert "frontswap: remove support for multiple ops" 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/frontswap.h | 3 +- include/linux/swapfile.h | 2 + mm/frontswap.c | 91 +++++++++++++++++++++++++++++++++------ mm/swapfile.c | 4 +- mm/zswap.c | 85 +++++++++++++++++++++++++----------- 5 files changed, 145 insertions(+), 40 deletions(-) -- 2.25.1