Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752274AbaBNG5a (ORCPT ); Fri, 14 Feb 2014 01:57:30 -0500 Received: from lgeamrelo01.lge.com ([156.147.1.125]:58134 "EHLO LGEAMRELO01.lge.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751815AbaBNG50 (ORCPT ); Fri, 14 Feb 2014 01:57:26 -0500 X-AuditID: 9c93017d-b7c89ae000006ae1-d9-52fdbe54f709 From: Joonsoo Kim To: Pekka Enberg Cc: Christoph Lameter , Andrew Morton , David Rientjes , Wanpeng Li , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Joonsoo Kim , Joonsoo Kim Subject: [PATCH 1/9] slab: add unlikely macro to help compiler Date: Fri, 14 Feb 2014 15:57:15 +0900 Message-Id: <1392361043-22420-2-git-send-email-iamjoonsoo.kim@lge.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1392361043-22420-1-git-send-email-iamjoonsoo.kim@lge.com> References: <1392361043-22420-1-git-send-email-iamjoonsoo.kim@lge.com> X-Brightmail-Tracker: AAAAAA== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org slab_should_failslab() is called on every allocation, so to optimize it is reasonable. We normally don't allocate from kmem_cache. It is just used when new kmem_cache is created, so it's very rare case. Therefore, add unlikely macro to help compiler optimization. Signed-off-by: Joonsoo Kim diff --git a/mm/slab.c b/mm/slab.c index 8347d80..5906f8f 100644 --- a/mm/slab.c +++ b/mm/slab.c @@ -3009,7 +3009,7 @@ static void *cache_alloc_debugcheck_after(struct kmem_cache *cachep, static bool slab_should_failslab(struct kmem_cache *cachep, gfp_t flags) { - if (cachep == kmem_cache) + if (unlikely(cachep == kmem_cache)) return false; return should_failslab(cachep->object_size, flags, cachep->flags); -- 1.7.9.5 -- 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/