From: Andrew Morton <akpm@linux-foundation.org>
To: Christoph Lameter <cl@linux.com>
Cc: Jesper Dangaard Brouer <brouer@redhat.com>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
akpm@linuxfoundation.org, Pekka Enberg <penberg@kernel.org>,
iamjoonsoo@lge.com
Subject: Re: Slab infrastructure for bulk object allocation and freeing V2
Date: Thu, 2 Apr 2015 13:42:39 -0700 [thread overview]
Message-ID: <20150402134239.8e8c538103640d697246ba6a@linux-foundation.org> (raw)
In-Reply-To: <alpine.DEB.2.11.1504020922120.28416@gentwo.org>
On Thu, 2 Apr 2015 09:25:37 -0500 (CDT) Christoph Lameter <cl@linux.com> wrote:
> > What's the reason for returning a partial result when ENOMEM? Some
> > callers will throw away the partial result and simply fail out. If a
> > caller attempts to go ahead and use the partial result then great, but
> > you can bet that nobody will actually runtime test this situation, so
> > the interface is an invitation for us to release partially-tested code
> > into the wild.
>
> Just rely on the fact that small allocations never fail? The caller get
> all the requested objects if the function returns?
I'd suggest the latter: either the callee successfully allocates all
the requested objects or it fails.
> > Instead of the above, did you consider doing
> >
> > int __weak kmem_cache_alloc_array(struct kmem_cache *s, gfp_t flags, size_t nr,
> >
> > ?
> >
> > This way we save a level of function call and all that wrapper code in
> > the allocators simply disappears.
>
> I think we will need the auxiliary function in the common code later
> because that allows the allocations to only do the allocations that
> can be optimized and for the rest just fall back to the generic
> implementations. There may be situations in which the optimizations wont
> work. For SLUB this may be the case f.e. if debug options are enabled.
hm, OK. The per-allocator wrappers could be made static inline in .h
if that makes sense.
With the current code, gcc should be able to convert the call into a
tailcall.
<checks>
nope.
kmem_cache_free_array:
pushq %rbp #
movq %rsp, %rbp #,
call __kmem_cache_free_array #
leave
ret
stupid gcc.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2015-04-02 20:42 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-30 14:31 Slab infrastructure for bulk object allocation and freeing V2 Christoph Lameter
2015-03-31 0:17 ` Jesper Dangaard Brouer
2015-03-31 21:20 ` Andrew Morton
2015-04-02 14:25 ` Christoph Lameter
2015-04-02 20:42 ` Andrew Morton [this message]
2015-04-06 18:27 ` Christoph Lameter
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=20150402134239.8e8c538103640d697246ba6a@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=akpm@linuxfoundation.org \
--cc=brouer@redhat.com \
--cc=cl@linux.com \
--cc=iamjoonsoo@lge.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=penberg@kernel.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).