From: Andrea Righi <andrea.righi@canonical.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Luis Chamberlain <mcgrof@kernel.org>,
linux-modules@vger.kernel.org, patches@lists.linux.dev,
linux-kernel@vger.kernel.org, keescook@chromium.org,
zhumao001@208suo.com, yangtiezhu@loongson.cn, ojeda@kernel.org
Subject: Re: [GIT PULL] Modules changes for v6.7-rc1
Date: Thu, 2 Nov 2023 08:29:15 +0100 [thread overview]
Message-ID: <ZUNPy/sMRxdo+o2w@gpd> (raw)
In-Reply-To: <CAHk-=wi=goCaTm6ZOKzm_ztky9ZT-vuGDWv39vVdtQT+oW=zEg@mail.gmail.com>
On Wed, Nov 01, 2023 at 09:21:09PM -1000, Linus Torvalds wrote:
> On Wed, 1 Nov 2023 at 21:02, Linus Torvalds
> <torvalds@linux-foundation.org> wrote:
> >
> > kmalloc() isn't just about "use physically contiguous allocations".
> > It's also more memory-efficient, and a *lot* faster than vmalloc(),
> > which has to play VM tricks.
>
> I've pulled this, but I think you should do something like the
> attached (UNTESTED!) patch.
>
> Linus
Looks good to me, I'll give it a try ASAP.
-Andrea
> kernel/module/decompress.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/kernel/module/decompress.c b/kernel/module/decompress.c
> index 4156d59be440..474e68f0f063 100644
> --- a/kernel/module/decompress.c
> +++ b/kernel/module/decompress.c
> @@ -100,7 +100,7 @@ static ssize_t module_gzip_decompress(struct load_info *info,
> s.next_in = buf + gzip_hdr_len;
> s.avail_in = size - gzip_hdr_len;
>
> - s.workspace = vmalloc(zlib_inflate_workspacesize());
> + s.workspace = kvmalloc(zlib_inflate_workspacesize(), GFP_KERNEL);
> if (!s.workspace)
> return -ENOMEM;
>
> @@ -138,7 +138,7 @@ static ssize_t module_gzip_decompress(struct load_info *info,
> out_inflate_end:
> zlib_inflateEnd(&s);
> out:
> - vfree(s.workspace);
> + kvfree(s.workspace);
> return retval;
> }
> #elif defined(CONFIG_MODULE_COMPRESS_XZ)
> @@ -241,7 +241,7 @@ static ssize_t module_zstd_decompress(struct load_info *info,
> }
>
> wksp_size = zstd_dstream_workspace_bound(header.windowSize);
> - wksp = vmalloc(wksp_size);
> + wksp = kvmalloc(wksp_size, GFP_KERNEL);
> if (!wksp) {
> retval = -ENOMEM;
> goto out;
> @@ -284,7 +284,7 @@ static ssize_t module_zstd_decompress(struct load_info *info,
> retval = new_size;
>
> out:
> - vfree(wksp);
> + kvfree(wksp);
> return retval;
> }
> #else
next prev parent reply other threads:[~2023-11-02 7:29 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-01 20:13 [GIT PULL] Modules changes for v6.7-rc1 Luis Chamberlain
2023-11-02 7:02 ` Linus Torvalds
2023-11-02 7:21 ` Linus Torvalds
2023-11-02 7:29 ` Andrea Righi [this message]
2023-11-02 8:19 ` Andrea Righi
2023-11-02 7:22 ` Andrea Righi
2023-11-02 7:23 ` pr-tracker-bot
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=ZUNPy/sMRxdo+o2w@gpd \
--to=andrea.righi@canonical.com \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-modules@vger.kernel.org \
--cc=mcgrof@kernel.org \
--cc=ojeda@kernel.org \
--cc=patches@lists.linux.dev \
--cc=torvalds@linux-foundation.org \
--cc=yangtiezhu@loongson.cn \
--cc=zhumao001@208suo.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.