[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220825190145.b0fc3267e16705866660f947@linux-foundation.org>
Date: Thu, 25 Aug 2022 19:01:45 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: Liu Shixin <liushixin2@...wei.com>
Cc: Seth Jennings <sjenning@...hat.com>,
Dan Streetman <ddstreet@...e.org>,
Vitaly Wool <vitaly.wool@...sulko.com>, <linux-mm@...ck.org>,
<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH -next 2/3] mm/zswap: delay the initializaton of zswap
until the first enablement
On Thu, 25 Aug 2022 22:20:36 +0800 Liu Shixin <liushixin2@...wei.com> wrote:
> In the initialization of zswap, about 18MB memory will be allocated for
> zswap_pool in my machine. 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.
>
> ...
>
> +static int __init init_zswap(void)
> +{
> + /* skip init if zswap is disabled when system startup */
> + if (!zswap_enabled)
> + return 0;
> + return zswap_setup();
> +}
> +
I can't resist.
--- a/mm/zswap.c~mm-zswap-delay-the-initializaton-of-zswap-until-the-first-enablement-fix
+++ a/mm/zswap.c
@@ -1556,7 +1556,7 @@ cache_fail:
return -ENOMEM;
}
-static int __init init_zswap(void)
+static int __init zswap_init(void)
{
/* skip init if zswap is disabled when system startup */
if (!zswap_enabled)
@@ -1565,7 +1565,7 @@ static int __init init_zswap(void)
}
/* must be late so crypto has time to come up */
-late_initcall(init_zswap);
+late_initcall(zswap_init);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Seth Jennings <sjennings@...iantweb.net>");
It's the usual way and makes things more consistent.
Powered by blists - more mailing lists