[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZUNOTRWCWNJkn66n@gpd>
Date: Thu, 2 Nov 2023 08:22:53 +0100
From: Andrea Righi <andrea.righi@...onical.com>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Luis Chamberlain <mcgrof@...nel.org>,
linux-modules@...r.kernel.org, patches@...ts.linux.dev,
linux-kernel@...r.kernel.org, keescook@...omium.org,
zhumao001@...suo.com, yangtiezhu@...ngson.cn, ojeda@...nel.org
Subject: Re: [GIT PULL] Modules changes for v6.7-rc1
On Wed, Nov 01, 2023 at 09:02:51PM -1000, Linus Torvalds wrote:
> On Wed, 1 Nov 2023 at 10:13, Luis Chamberlain <mcgrof@...nel.org> wrote:
> >
> > The only thing worth highligthing is that gzip moves to use vmalloc() instead of
> > kmalloc just as we had a fix for this for zstd on v6.6-rc1.
>
> Actually, that's almost certainly entirely the wrong thing to do.
>
> Unless you *know* that the allocation is large, you shouldn't use
> vmalloc(). And since kmalloc() has worked fine, you most definitely
> don't know that.
>
> So we have 'kvmalloc()' *exactly* for this reason, which is a "use
> kmalloc, unless that is too small, then use vmalloc".
>
> 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.
>
> So this "just switch to vmalloc()" is entirely wrong.
>
> Linus
I proposed that change mostlfy for consistency with the zstd case, but I
haven't experience any issue with gzip compressed modules (that seem to
require less memory, even with larger modules).
So, yes, it probably makes sense to drop this change for now and I can
send another patch to switch to kvmalloc() for all the decompress cases.
Thanks,
-Andrea
Powered by blists - more mailing lists