Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp162457rwl; Fri, 24 Mar 2023 23:28:35 -0700 (PDT) X-Google-Smtp-Source: AKy350aljmk94S2tjIkuhNnZD4bkOJfYca4aCWv1lOJ7W3sTVdmCn6GkbstUImrxnyAjsoxKor7O X-Received: by 2002:aa7:93c4:0:b0:626:6a3:6b81 with SMTP id y4-20020aa793c4000000b0062606a36b81mr5108053pff.15.1679725714933; Fri, 24 Mar 2023 23:28:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679725714; cv=none; d=google.com; s=arc-20160816; b=TjNP+yb2xyPLgaw8IB6m73Zqw3fvZ6A2X9w/uJNCp509H0QUs3Ky83KG2pFW3Mm0pU pkFQmCjmwrr/Z+gsb7+7yuSpW+sC8xr/9wy42kZACt1mSf/3LeUBnTnIFGySaCogrPy2 ZefMWs1u479ngcgzE4Ps8RnVPmHohsfwB6wGcC7mxPfpyf2u+fTRCBDliY0kIZhn9/Jy cQNmpzi73gZPMRNDYPoneYxGUyAeQGj6beANf23zRBQglF5CjkRw+WZ4Dlc81V7X7xa3 ycBmFsp5MkwiRPqN6H0CdomvygMD3LI0Cw3WQdNsqjYHzhh3j1oDCz4KPgsh/pSZad35 kYcw== 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=YqRJjmGqyFTC/0k/czhpubg7zFqQ7v4LwXzVttNzS/o=; b=HJ/73KS/3r93C+yigduEZAlnh52rJp/MIDtXSy5UlmSdwThSoLG3H6p1KVmUAUuEmD 0zqR3c+1qU6UT6ORWpbJ7NrmEgoZe+5eyYMCDn9+ILMh8Hqt87TLFEiOQErUL3EakwMu 6B+I6nDSWMMZ2NPil1t4fI7jae11RCtQYQy7XZ6XWuhMEkmBqae448dQLKDlDmQLOUEI 8tn56r4jYqYb71xAj/c/EfPJCS5L7F21c5jNTSWd3zNXagGz/5o3XdiXRuDcOV6KxCvJ pfyyeNPWpoYdvjwuzFA4wR577DTJjf00nHEkMkI3XSp/P2X8r6tGR0Z6XZb2mcwT7jzG Sf5Q== 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 f204-20020a6238d5000000b0062a4fb857easi5360053pfa.366.2023.03.24.23.28.23; Fri, 24 Mar 2023 23:28:34 -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 S232083AbjCYGYc (ORCPT + 99 others); Sat, 25 Mar 2023 02:24:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230133AbjCYGYb (ORCPT ); Sat, 25 Mar 2023 02:24:31 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01FC315174 for ; Fri, 24 Mar 2023 23:24:25 -0700 (PDT) Received: from dggpemm100009.china.huawei.com (unknown [172.30.72.56]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4Pk8DF1KNjzKmMW; Sat, 25 Mar 2023 14:23:57 +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; Sat, 25 Mar 2023 14:24:21 +0800 From: Liu Shixin To: Seth Jennings , Dan Streetman , Vitaly Wool , Andrew Morton , Nathan Chancellor , Christoph Hellwig CC: , , Liu Shixin Subject: [PATCH -next v7 0/4] Delay the initialization of zswap Date: Sat, 25 Mar 2023 15:14:16 +0800 Message-ID: <20230325071420.2246461-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=-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 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. v6->v7: Add two new patch[1,3] to cleanup the code. And cover zswap_init_* parameter by zswap_init_lock to protect against conflicts. v5->v6: Simplify the code and delete the patches about frontswap suggested by Christoph. Liu Shixin (4): mm/zswap: remove zswap_entry_cache_{create,destroy} helper function mm/zswap: skip invalid or unchanged parameter mm/zswap: replace zswap_init_{started/failed} with zswap_init_state mm/zswap: delay the initializaton of zswap mm/zswap.c | 94 +++++++++++++++++++++++++++++++++++------------------- 1 file changed, 61 insertions(+), 33 deletions(-) -- 2.25.1