lkml.org 
[lkml]   [2011]   [Jan]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: Should we be using unlikely() around tests of GFP_ZERO?
From
Hi Ted,

On Mon, Jan 03, 2011 at 09:40:57AM +0200, Pekka Enberg wrote:
>> I guess the rationale here is that if you're going to take the hit of
>> memset() you can take the hit of unlikely() as well. We're optimizing
>> for hot call-sites that allocate a small amount of memory and
>> initialize everything themselves. That said, I don't think the
>> unlikely() annotation matters much either way and am for removing it
>> unless people object to that.

On Mon, Jan 3, 2011 at 3:58 PM, Ted Ts'o <tytso@mit.edu> wrote:
> I suspect for many slab caches, all of the slab allocations for a
> given slab cache type will have the GFP_ZERO flag passed.  So maybe it
> would be more efficient to zap the entire page when it is pressed into
> service for a particular slab cache, so we can avoid needing to use
> memset on a per-object basis?

We'd then need to do memset() in kmem_cache_free() because callers are
not required to clean up after them. In general, we don't want to do
that because object cachelines are less likely to be touched after
free than they are after allocation (you usually use the memory
immediately after you allocate).

Pekka
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2011-01-03 15:13    [W:0.052 / U:0.256 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site