From: Kyle Moffett <kyle@moffetthome.net>
To: Nick Piggin <nickpiggin@yahoo.com.au>
Cc: Matt Mackall <mpm@selenic.com>,
Herbert Xu <herbert@gondor.apana.org.au>,
Pekka Enberg <penberg@cs.helsinki.fi>,
"Kirill A. Shutemov" <kirill@shutemov.name>,
Christoph Lameter <cl@linux-foundation.org>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
linux-crypto@vger.kernel.org, Geert.Uytterhoeven@sonycom.com
Subject: Re: [PATCH] Export symbol ksize()
Date: Fri, 13 Feb 2009 11:57:52 -0500 [thread overview]
Message-ID: <f73f7ab80902130857x2acd13afk3e704f4ad64333a7@mail.gmail.com> (raw)
In-Reply-To: <200902140020.45522.nickpiggin@yahoo.com.au>
On Fri, Feb 13, 2009 at 8:20 AM, Nick Piggin <nickpiggin@yahoo.com.au> wrote:
> On Friday 13 February 2009 10:37:01 Matt Mackall wrote:
>> On Fri, 2009-02-13 at 07:09 +0800, Herbert Xu wrote:
>> > On Fri, Feb 13, 2009 at 12:10:45AM +1100, Nick Piggin wrote:
>> > > I would be interested to know how that goes. You always have this
>> > > circular issue that if a little more space helps significantly, then
>> > > maybe it is a good idea to explicitly ask for those bytes. Of course
>> > > that larger allocation is also likely to have some slack bytes.
>> >
>> > Well, the thing is we don't know apriori whether we need the
>> > extra space. The idea is to use the extra space if available
>> > to avoid reallocation when we hit things like IPsec.
>>
>> I'm not entirely convinced by this argument. If you're concerned about
>> space rather than performance, then you want an allocator that doesn't
>> waste space in the first place and you don't try to do "sub-allocations"
>> by hand. If you're concerned about performance, you instead optimize
>> your allocator to be as fast as possible and again avoid conditional
>> branches for sub-allocations.
>
> Well, my earlier reasoning is no longer so clear cut if eg. there
> are common cases where no extra space is required, but rare cases
> where extra space might be a big win if it eg avoids extra
> alloc, copy, free or something.
>
> Because even with performance oriented allocators, there is a non-zero
> cost to explicitly asking for more memory -- queues tend to get smaller
> at larger object sizes, and page allocation orders can increase. So if
> it is very uncommon to need extra space you don't want to burden the
> common case with it.
My concern would be that such extra-space reuse would be a very
non-obvious performance hit if allocation patterns changed slightly.
If being able to use the extra space really is a noticeable "big win"
for the rare case, then minor changes to the memory allocator could
dramatically impact performance in a totally nondeterministic way. If
the change isn't performance-significant in the grand scheme of
things, then the use of ksize() would just be code obfuscation. On
the other hand if it *is* performance-significant, it should be
redesigned to be able to guarantee that the space is available when it
is needed.
Cheers,
Kyle Moffett
--
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:[~2009-02-13 16:57 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-10 13:21 [PATCH] Export symbol ksize() Kirill A. Shutemov
2009-02-10 13:35 ` Pekka Enberg
2009-02-10 13:46 ` Kirill A. Shutemov
2009-02-10 14:06 ` Pekka J Enberg
2009-02-12 10:43 ` Herbert Xu
2009-02-12 10:45 ` Pekka Enberg
2009-02-12 10:50 ` Herbert Xu
2009-02-12 13:10 ` Nick Piggin
2009-02-12 23:09 ` Herbert Xu
2009-02-12 23:37 ` Matt Mackall
2009-02-13 13:20 ` Nick Piggin
2009-02-13 16:57 ` Kyle Moffett [this message]
2009-02-12 15:55 ` Pekka Enberg
2009-02-12 23:09 ` Herbert Xu
2009-02-15 21:36 ` Andrew Morton
2009-02-15 21:43 ` Matt Mackall
2009-02-15 21:55 ` Andrew Morton
2009-02-15 23:49 ` Matt Mackall
2009-02-16 1:00 ` Andrew Morton
2009-02-16 1:21 ` Herbert Xu
2009-02-16 1:28 ` Matt Mackall
2009-02-16 1:52 ` Herbert Xu
2009-02-16 1:54 ` Matt Mackall
2009-02-16 1:57 ` Herbert Xu
2009-02-16 1:38 ` Matt Mackall
2009-02-17 8:43 ` Geert Uytterhoeven
2009-02-17 16:17 ` Christoph Lameter
2009-02-17 17:03 ` Pekka Enberg
2009-02-17 17:06 ` Christoph Lameter
2009-02-16 13:56 ` Johannes Weiner
2009-02-16 14:09 ` Pekka Enberg
2009-02-16 16:32 ` Joe Perches
2009-02-16 17:29 ` Pekka Enberg
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=f73f7ab80902130857x2acd13afk3e704f4ad64333a7@mail.gmail.com \
--to=kyle@moffetthome.net \
--cc=Geert.Uytterhoeven@sonycom.com \
--cc=cl@linux-foundation.org \
--cc=herbert@gondor.apana.org.au \
--cc=kirill@shutemov.name \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mpm@selenic.com \
--cc=nickpiggin@yahoo.com.au \
--cc=penberg@cs.helsinki.fi \
/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).