From mboxrd@z Thu Jan 1 00:00:00 1970 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 62F3AC74A5B for ; Sun, 26 Mar 2023 23:29:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230201AbjCZX3X (ORCPT ); Sun, 26 Mar 2023 19:29:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230104AbjCZX3V (ORCPT ); Sun, 26 Mar 2023 19:29:21 -0400 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1280259DB for ; Sun, 26 Mar 2023 16:29:14 -0700 (PDT) Received: by verein.lst.de (Postfix, from userid 2407) id B7DFB68B05; Mon, 27 Mar 2023 01:29:09 +0200 (CEST) Date: Mon, 27 Mar 2023 01:29:09 +0200 From: Christoph Hellwig To: Liu Shixin Cc: Seth Jennings , Dan Streetman , Vitaly Wool , Andrew Morton , Nathan Chancellor , Christoph Hellwig , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH -next v7 4/4] mm/zswap: delay the initializaton of zswap Message-ID: <20230326232909.GD19631@lst.de> References: <20230325071420.2246461-1-liushixin2@huawei.com> <20230325071420.2246461-5-liushixin2@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230325071420.2246461-5-liushixin2@huawei.com> User-Agent: Mutt/1.5.17 (2007-11-01) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > @@ -1480,11 +1500,14 @@ static int __init zswap_debugfs_init(void) > /********************************* > * module init and exit > **********************************/ > -static int __init init_zswap(void) > +static int zswap_setup(void) > { > struct zswap_pool *pool; > int ret; > > + if (zswap_init_state != ZSWAP_UNINIT) > + return 0; I feel like doing this in zswap_enabled_param_set would be a lot cleaner. With that we could do a switch on the possible enum values for zswap_init_state there, and that is a good way to explain the possible outcomes.