From: Jesper Dangaard Brouer <brouer@redhat.com>
To: David Howells <dhowells@redhat.com>
Cc: Christoph Lameter <cl@linux.com>,
Andrew Morton <akpm@linux-foundation.org>,
linux-mm <linux-mm@kvack.org>,
brouer@redhat.com
Subject: Re: Bulk kmalloc
Date: Fri, 10 May 2019 13:50:31 +0200 [thread overview]
Message-ID: <20190510135031.1e8908fd@carbon> (raw)
In-Reply-To: <14647.1557415738@warthog.procyon.org.uk>
On Thu, 09 May 2019 16:28:58 +0100 David Howells <dhowells@redhat.com> wrote:
> Is it possible to use kmem_cache_alloc_bulk() with kmalloc slabs to
> effect a bulk kmalloc?
Well, we have kfree_bulk() which is a simple wrapper around
kmem_cache_free_bulk() (as Christoph make me handle that case).
We/I didn't code the kmalloc_bulk() variant.
What is you use case?
(p.s. fixed the MM-email address)
--
Best regards,
Jesper Dangaard Brouer
MSc.CS, Principal Kernel Engineer at Red Hat
LinkedIn: http://www.linkedin.com/in/brouer
static __always_inline void kfree_bulk(size_t size, void **p)
{
kmem_cache_free_bulk(NULL, size, p);
}
Handling code for kfree_bulk case:
page = virt_to_head_page(object);
if (!s) {
/* Handle kalloc'ed objects */
if (unlikely(!PageSlab(page))) {
BUG_ON(!PageCompound(page));
kfree_hook(object);
__free_pages(page, compound_order(page));
p[size] = NULL; /* mark object processed */
return size;
}
/* Derive kmem_cache from object */
df->s = page->slab_cache;
} else {
df->s = cache_from_obj(s, object); /* Support for memcg */
}
next parent reply other threads:[~2019-05-10 11:50 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <14647.1557415738@warthog.procyon.org.uk>
2019-05-10 11:50 ` Jesper Dangaard Brouer [this message]
2019-05-10 16:23 ` Bulk kmalloc David Howells
2019-05-10 16:50 ` Matthew Wilcox
2019-05-10 17:11 ` Christoph Hellwig
2019-05-10 17:35 ` Matthew Wilcox
2019-05-13 12:04 ` David Howells
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=20190510135031.1e8908fd@carbon \
--to=brouer@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=cl@linux.com \
--cc=dhowells@redhat.com \
--cc=linux-mm@kvack.org \
/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;
as well as URLs for NNTP newsgroup(s).