[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1420421851-3281-6-git-send-email-iamjoonsoo.kim@lge.com>
Date: Mon, 5 Jan 2015 10:37:30 +0900
From: Joonsoo Kim <iamjoonsoo.kim@....com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: Christoph Lameter <cl@...ux.com>,
Pekka Enberg <penberg@...nel.org>,
David Rientjes <rientjes@...gle.com>,
Joonsoo Kim <iamjoonsoo.kim@....com>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org,
Jesper Dangaard Brouer <brouer@...hat.com>
Subject: [PATCH 5/6] mm/slab: cleanup ____cache_alloc()
This cleanup makes code more readable and help future changes.
In the following patch, many code will be added to this function.
Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@....com>
---
mm/slab.c | 26 ++++++++++++++------------
1 file changed, 14 insertions(+), 12 deletions(-)
diff --git a/mm/slab.c b/mm/slab.c
index 1246ac6..449fc6b 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -2939,21 +2939,23 @@ static inline void *____cache_alloc(struct kmem_cache *cachep, gfp_t flags)
local_irq_save(save_flags);
ac = cpu_cache_get(cachep);
- if (likely(ac->avail)) {
- ac->touched = 1;
- objp = ac_get_obj(cachep, ac, flags, false);
+ if (unlikely(!ac->avail))
+ goto slowpath;
- /*
- * Allow for the possibility all avail objects are not allowed
- * by the current flags
- */
- if (objp) {
- STATS_INC_ALLOCHIT(cachep);
- goto out;
- }
- force_refill = true;
+ ac->touched = 1;
+ objp = ac_get_obj(cachep, ac, flags, false);
+
+ /*
+ * Allow for the possibility all avail objects are not allowed
+ * by the current flags
+ */
+ if (likely(objp)) {
+ STATS_INC_ALLOCHIT(cachep);
+ goto out;
}
+ force_refill = true;
+slowpath:
STATS_INC_ALLOCMISS(cachep);
objp = cache_alloc_refill(cachep, flags, force_refill);
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists