From patchwork Fri Aug 26 07:34:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Shixin X-Patchwork-Id: 12955599 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id AFC8AECAAA3 for ; Fri, 26 Aug 2022 07:00:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 31248940007; Fri, 26 Aug 2022 03:00:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 29AFA6B007B; Fri, 26 Aug 2022 03:00:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 13CA0940007; Fri, 26 Aug 2022 03:00:03 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 0010B6B0078 for ; Fri, 26 Aug 2022 03:00:02 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id B898A120CB9 for ; Fri, 26 Aug 2022 07:00:02 +0000 (UTC) X-FDA: 79840844244.17.06A1BAB Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf17.hostedemail.com (Postfix) with ESMTP id C661940015 for ; Fri, 26 Aug 2022 07:00:01 +0000 (UTC) Received: from dggpemm500021.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4MDVx50L3HzkWK5; Fri, 26 Aug 2022 14:56:25 +0800 (CST) Received: from dggpemm100009.china.huawei.com (7.185.36.113) by dggpemm500021.china.huawei.com (7.185.36.109) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Fri, 26 Aug 2022 14:59:57 +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; Fri, 26 Aug 2022 14:59:57 +0800 From: Liu Shixin To: Seth Jennings , Dan Streetman , Vitaly Wool , Andrew Morton CC: , , Liu Shixin , Kefeng Wang Subject: [PATCH -next v2 0/3] Delay the initializaton of zswap Date: Fri, 26 Aug 2022 15:34:29 +0800 Message-ID: <20220826073432.4168976-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: dggems701-chm.china.huawei.com (10.3.19.178) To dggpemm100009.china.huawei.com (7.185.36.113) X-CFilter-Loop: Reflected ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1661497202; a=rsa-sha256; cv=none; b=V2dXifHfuEA7CwoD0WECYbE5MWDUi40ER9Qq8LviJ0HFJatw6WnG9qKgo0F9/qNK9WY/V/ cr2Wsm/k2zWu07Qx+/MBxuKx9fkmQJ53eEUAj471kQbo4HVGhK5Bmpo7lnZj9vPKG28DEp 1ZqJlGLFSEqY1RDQThj2IxTSsS5f/Os= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf17.hostedemail.com: domain of liushixin2@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=liushixin2@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1661497202; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references; bh=UtS38zuynlXPkBZYmIQ86cDIK65mENPCJyOo27HEEFk=; b=WNw8QcE34rWDbdX8/qL+pgwwTfJXxlD3PG0HEakzgwE6694glDstLi9hkQIdFA+6h3ErtK fNkJNwYz7tC2/Qj6MJ4wccRYBOb5jcufbHNMScdc8KK1Zj7wzIIczVEyTani/VJ8cGbflf oQfUhKyqEuONpqWqUqlEHpRSm4Rt1Gg= X-Rspam-User: Authentication-Results: imf17.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf17.hostedemail.com: domain of liushixin2@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=liushixin2@huawei.com X-Rspamd-Server: rspam12 X-Stat-Signature: uw3frd7zoyrpw3qdnjddjz788xhenqu8 X-Rspamd-Queue-Id: C661940015 X-HE-Tag: 1661497201-948251 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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. v1->v2: Change init_zswap to zswap_init suggested by Andrew. Liu Shixin (3): 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 mm/zswap.c | 77 ++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 58 insertions(+), 19 deletions(-)