[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=whZ+iCW5yMc3zuTpZrZzjb082xtVyzk3rV+S0SUNrtAAw@mail.gmail.com>
Date: Sat, 16 Oct 2021 11:10:19 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Paolo Bonzini <pbonzini@...hat.com>
Cc: KVM list <kvm@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Sean Christopherson <seanjc@...gle.com>,
Willy Tarreau <w@....eu>, Kees Cook <keescook@...omium.org>,
syzbot+e0de2333cbf95ea473e8@...kaller.appspotmail.com
Subject: Re: [PATCH] mm: allow huge kvmalloc() calls if they're accounted to memcg
On Sat, Oct 16, 2021 at 10:53 AM Paolo Bonzini <pbonzini@...hat.com> wrote:
>
> Sounds good, and you'll get a pull request for that tomorrow. Then I'll
> send via Andrew a patch to add __vcalloc, so that the accounting is
> restored.
Ahh. So you used kvmalloc() mainly because the regular vmalloc()
doesn't do the gfp-flags.
We do have that "__vmalloc()" thing, but the double underscore naming
makes it a bit unfortunate (since it tends to mean "local special use
only").
I suspect you could just make "vcalloc()".
That said, I also do wonder if we could possibly change "kvcalloc()"
to avoid the warning. The reason I didn't like your patch is that
kvmalloc_node() only takes a "size_t", and the overflow condition
there is that "MAX_INT".
But the "kvcalloc()" case that takes a "number of elements and size"
should _conceptually_ warn not when the total size overflows, but when
either number or the element size overflows.
So I would also accept a patch that just changes how "kvcalloc()"
works (or how "kvmalloc_array()" works).
It's a bit annoying how we've ended up losing that "n/size"
information by the time we hit kvmalloc().
Linus
Powered by blists - more mailing lists