linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Liu Shixin <liushixin2@huawei.com>
Cc: Seth Jennings <sjenning@redhat.com>,
	Dan Streetman <ddstreet@ieee.org>,
	Vitaly Wool <vitaly.wool@konsulko.com>, <linux-mm@kvack.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH -next 2/3] mm/zswap: delay the initializaton of zswap until the first enablement
Date: Thu, 25 Aug 2022 19:01:45 -0700	[thread overview]
Message-ID: <20220825190145.b0fc3267e16705866660f947@linux-foundation.org> (raw)
In-Reply-To: <20220825142037.3214152-3-liushixin2@huawei.com>

On Thu, 25 Aug 2022 22:20:36 +0800 Liu Shixin <liushixin2@huawei.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@variantweb.net>");

It's the usual way and makes things more consistent.


  reply	other threads:[~2022-08-26  2:01 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-25 14:20 [PATCH -next 0/3] Delay the initializaton of zswap Liu Shixin
2022-08-25 14:20 ` [PATCH -next 1/3] mm/zswap: replace zswap_init_{started/failed} with zswap_init_state Liu Shixin
2022-08-25 14:20 ` [PATCH -next 2/3] mm/zswap: delay the initializaton of zswap until the first enablement Liu Shixin
2022-08-26  2:01   ` Andrew Morton [this message]
2022-08-26 20:25   ` Nathan Chancellor
2022-08-27  1:43     ` Andrew Morton
2022-08-27  2:01     ` Kefeng Wang
2022-08-27 10:21     ` Liu Shixin
2022-08-25 14:20 ` [PATCH -next 3/3] mm/zswap: skip confusing print info Liu Shixin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220825190145.b0fc3267e16705866660f947@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=ddstreet@ieee.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=liushixin2@huawei.com \
    --cc=sjenning@redhat.com \
    --cc=vitaly.wool@konsulko.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox