* [PATCH] mm, slab_common: add 'unlikely' to size check of kmalloc_slab()
@ 2013-08-02 2:02 Joonsoo Kim
2013-08-02 14:49 ` Christoph Lameter
0 siblings, 1 reply; 2+ messages in thread
From: Joonsoo Kim @ 2013-08-02 2:02 UTC (permalink / raw)
To: Pekka Enberg
Cc: Christoph Lameter, linux-mm, linux-kernel, Joonsoo Kim, Joonsoo Kim
Size is usually below than KMALLOC_MAX_SIZE.
If we add a 'unlikely' macro, compiler can make better code.
Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
diff --git a/mm/slab_common.c b/mm/slab_common.c
index 538bade..f0410eb 100644
--- a/mm/slab_common.c
+++ b/mm/slab_common.c
@@ -373,7 +373,7 @@ struct kmem_cache *kmalloc_slab(size_t size, gfp_t flags)
{
int index;
- if (size > KMALLOC_MAX_SIZE) {
+ if (unlikely(size > KMALLOC_MAX_SIZE)) {
WARN_ON_ONCE(!(flags & __GFP_NOWARN));
return NULL;
}
--
1.7.9.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] mm, slab_common: add 'unlikely' to size check of kmalloc_slab()
2013-08-02 2:02 [PATCH] mm, slab_common: add 'unlikely' to size check of kmalloc_slab() Joonsoo Kim
@ 2013-08-02 14:49 ` Christoph Lameter
0 siblings, 0 replies; 2+ messages in thread
From: Christoph Lameter @ 2013-08-02 14:49 UTC (permalink / raw)
To: Joonsoo Kim; +Cc: Pekka Enberg, linux-mm, linux-kernel, Joonsoo Kim
On Fri, 2 Aug 2013, Joonsoo Kim wrote:
> Size is usually below than KMALLOC_MAX_SIZE.
> If we add a 'unlikely' macro, compiler can make better code.
Acked-by: Christoph Lameter <cl@linux.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-08-02 14:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-02 2:02 [PATCH] mm, slab_common: add 'unlikely' to size check of kmalloc_slab() Joonsoo Kim
2013-08-02 14:49 ` Christoph Lameter
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).