Messages in this thread | | | From | Linus Torvalds <> | Date | Sat, 16 Oct 2021 11:10:19 -0700 | 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@redhat.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
| |