From patchwork Wed Mar 22 10:20:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Shixin X-Patchwork-Id: 13183736 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 E64C8C6FD1F for ; Wed, 22 Mar 2023 09:29:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7FDAC6B0075; Wed, 22 Mar 2023 05:29:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7ACD46B0078; Wed, 22 Mar 2023 05:29:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6C37A6B007B; Wed, 22 Mar 2023 05:29:31 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 5EF626B0075 for ; Wed, 22 Mar 2023 05:29:31 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 28EC91403CE for ; Wed, 22 Mar 2023 09:29:31 +0000 (UTC) X-FDA: 80596011342.15.16A13DE Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf18.hostedemail.com (Postfix) with ESMTP id C36DA1C0005 for ; Wed, 22 Mar 2023 09:29:28 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf18.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=1679477369; 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=pP2q28f07vmkKymfgR06aYMlcqowUlzm7VwJTvd0cR8=; b=Jxkh6l56Wtwk9Q+CY1hUe2UO1AnQCLrTwUJ2e6WksoJdKma7mgkp1jDDbqP2+T+Hk5isMw 0U+zjPfXkLDG0v6rogjH/nyo9sKMBQ8GJrgegH7ntH1Tv8/3gDSm9QJV+yZhwWhgQl4oC+ qJt2A5vOOrY4HCdqNR3n4tPp1+D4cd0= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf18.hostedemail.com: domain of liushixin2@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=liushixin2@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1679477369; a=rsa-sha256; cv=none; b=I7Hh3oelbx9HUC76KWtchdRfegSV+C6MV1VdOVSsLhyuWgPOmt0WAw/Kdm+tutBMjN2Akv Fx7ixeBsc0C6JPHicySaqbrikKK0m8QFH8RL2BUEK9e+tN3kRcUSfUFt7hXoRHOLcS7XFg ggkNFaaPT4eHU6KNL8jTf9AqS0aLPgA= Received: from dggpemm100009.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4PhNSR3wVbzrW99; Wed, 22 Mar 2023 17:28:23 +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; Wed, 22 Mar 2023 17:29:24 +0800 From: Liu Shixin To: Seth Jennings , Dan Streetman , Vitaly Wool , Andrew Morton , Nathan Chancellor , Christoph Hellwig CC: , , Liu Shixin Subject: [PATCH -next v6 0/2] Delay the initialization of zswap Date: Wed, 22 Mar 2023 18:20:04 +0800 Message-ID: <20230322102006.780624-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: dggems704-chm.china.huawei.com (10.3.19.181) To dggpemm100009.china.huawei.com (7.185.36.113) X-CFilter-Loop: Reflected X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: C36DA1C0005 X-Stat-Signature: fjae664a3htj5o3fcry4wnta7uriujr7 X-HE-Tag: 1679477368-48105 X-HE-Meta: U2FsdGVkX18+kOkpY99+xPTnprmUAt6iagAIyf+XgYJ6AbaXpjzZvczDHJRwOkCDIgZjtMUaPY6luB8xvuxuxM2thh2ryzheAoz00QKaoX9+zHM/Gg+9Tx4hRU2xObqFwtgphPkKYPyYpsU0iV/cr5574nSCSfJpXVJ502A9ZTA7ZuGEst1r/UsMM3lNz/oXbneVr8/KmukTjyLOjOy3CSw5Vd42R+M1xfZx6LZYfO1B16WUqiyGegkqnlSihS7EW92rZDefuBIiwLnlY3kDZ5iGreS3E0APElk54/zYBdlBfpWMp8tvilxwhrAQFkhecWmETDy3BA5yd19GXU3l3rPJ/LOwEQjSD/PsYIyZBmtc00wUE7bY/8lruNoF7CJmhKtsglpn/HbuO6UZX6qb2Hhp36ZFpK2mXep4LOkfKcru5sZbe3beNsPr2YCCcjRo8Z4dhtINM42aoMX3wJpHGhOJlb3Gs3A2xMHaL8PtX8VFBnhrVj0XZwmAnSkIn6ISPIjQJstFpjYCAb94MyHe1zw88dEJGsBDQuUdvwbW7JN7KDbJo//rp4hCUxNDLyHuweYX8iPaEVBqXNT13gFCagNeilEZvd0e6W7wdhTJ/aVtlyXqs4acDlkY+cP1pOjTjchBjrK+ci07xXhAVRnElztbrTXgoJdA+Q7EzP/Q3gv762FSE0qxXmwMBBG87IX3X74IaXkELHCR0K0SQfz5Sht1XIIUrqsKsTw3hZegRSg/JJGUkFZjVVeR7Qq5SmvSgCk1ibEo6Pel74tbx0s2deiyqhFtfsm3xFs5aEtAF3HNHpaRinbBQGJe2rylts/4Gb1cSTB39xSZP4b2bpFqeP6yrpuN2q2/xqgIENkdjzCMcq18dxVJa9TrEvxnU5Z2XcBiLLEZ+vLtQ1L2i76CEEIPvfdFMLQWxIzgfEpnhL6LUDzyLJEz7X1lrgOR2mmSwwbpnIUyITEKGLEe50d +ucDG/sS tRfnPKjKNKHirwREFyVrNu4n+gi35M5nEW9XiWiVT0BlVLLyHjROlf5MCq9fee3SU7x1r6FQy2HawfN+gqGsYRD7F9W+4JsOf8DingQAaWxyUwYN1ZqXkNnyb31FKxeUY7HVa8cSDbjuXbH8= 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 some users may not use zswap, the zswap_pool is wasted. Save memory by delaying the initialization of zswap until enabled. v5->v6: Simplify the code and delete the patches about frontswap suggested by Christoph. Liu Shixin (2): mm/zswap: skip invalid or unchanged parameter mm/zswap: delay the initializaton of zswap mm/zswap.c | 60 +++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 50 insertions(+), 10 deletions(-)