Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp1217932rwe; Sat, 27 Aug 2022 03:29:43 -0700 (PDT) X-Google-Smtp-Source: AA6agR4tfH6eskK+QHUQyJZlGz3yuWFF9rRyJM7MDGFI56l6VuprGUPM2AZwTVBALMtBoeaamegm X-Received: by 2002:a05:6402:1945:b0:446:692:8aeb with SMTP id f5-20020a056402194500b0044606928aebmr9542350edz.403.1661596183414; Sat, 27 Aug 2022 03:29:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661596183; cv=none; d=google.com; s=arc-20160816; b=YPm+tAIa2UWFliRQ+pzWGEQ+xSK02qr1Bbda7+C1ZBT2/W/p9KFFd52OpMucktN3fo sz75HiduCRcBZoW2JFU0hdHMhF7ClThQcqkhSa9hQ1Wt4aqsjlZqMsdpHjg4PTL+rgF1 7Ykd1QMPRg22Rsy6uXhUdQ7m9OkAs7umYZMcYKWluC5XdXouDJz9SWqqbJOruuLZxX1U MvteLmee7pgFLRd+/XL2UJxa6xfz0WqAwgUPYROFEJgTLgESmOE9PXYQQrYMxJFsb8QU lAUvEGyPO23b9e+8jeLGHKjyXF+X72ckDCCsDbkRTXua4zq8jhddEXBb+aUbb3TB8NsW pTZQ== 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=k0posIr2rzx+UGJbMeuJ21xBGTnEY5Us1ZLG8sJQ3Kg=; b=d3kpmR1QR6Mq8tGo3Aym49bVbL6Ycq8xndMBj5cGJTvrqwWCgvs7q61XXNtEQYJTH+ vyN4tKIcyY1NGOAzLKTU8awyZ4jaTX/VDNb0q8CEYPidpuIWwW46Vh8ez3eEpH70mzHY T1tUxE9jTvxRPUzyE2Pd7Sia+/1yMKlJ8zD0X75HSR2Gk/U7hMJzix45FpeZF3FrdIsi QBzU20FDNnqJxD6v9oYzgcx4OuPocy5YaY42Y+BDeaJx3luFwLaCWEio+S7w5207V0UJ qkLiUSGKJBy6Jn1DkhYwOnyvLdnSI0wtZieJuZSno+aDRucC+qpmn/2y2BhmVF0LLCEI V+2Q== 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 qf37-20020a1709077f2500b0072a6d845d91si3263858ejc.159.2022.08.27.03.28.59; Sat, 27 Aug 2022 03:29:43 -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 S233342AbiH0KLo (ORCPT + 99 others); Sat, 27 Aug 2022 06:11:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48216 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231890AbiH0KLm (ORCPT ); Sat, 27 Aug 2022 06:11:42 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 739C020F5D for ; Sat, 27 Aug 2022 03:11:39 -0700 (PDT) Received: from dggpemm500020.china.huawei.com (unknown [172.30.72.53]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4MFC7l50fVz1N7Z8; Sat, 27 Aug 2022 18:08:03 +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; Sat, 27 Aug 2022 18:11:37 +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; Sat, 27 Aug 2022 18:11:36 +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 v3 0/5] Delay the initializaton of zswap Date: Sat, 27 Aug 2022 18:45:55 +0800 Message-ID: <20220827104600.1813214-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: dggems705-chm.china.huawei.com (10.3.19.182) 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. 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): frontswap: skip frontswap_ops init if zswap init failed. frontswap: invoke ops->init for online swap device in 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 | 50 +++++++++++++++++++++++++- mm/swapfile.c | 4 +-- mm/zswap.c | 77 ++++++++++++++++++++++++++++++---------- 4 files changed, 111 insertions(+), 22 deletions(-) -- 2.25.1