From 1b9769cf7cb4ca0302ec87216f204576bb220cb1 Mon Sep 17 00:00:00 2001 From: Mel Gorman Date: Tue, 31 Jul 2012 16:44:30 -0700 Subject: [PATCH] --- yaml --- r: 320830 b: refs/heads/master c: 381760eadc393bcb1bb328510ad75cf13431806d h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/mm/slab.c | 28 ++++++++++++++++++++++++++-- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index 69bd9d94ac52..ec991fe8e47b 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: b4b9e3558508980fc0cd161a545ffb55a1f13ee9 +refs/heads/master: 381760eadc393bcb1bb328510ad75cf13431806d diff --git a/trunk/mm/slab.c b/trunk/mm/slab.c index 77be18dab73c..f8b0d539b482 100644 --- a/trunk/mm/slab.c +++ b/trunk/mm/slab.c @@ -118,6 +118,8 @@ #include #include +#include + #include #include #include @@ -965,7 +967,7 @@ static void recheck_pfmemalloc_active(struct kmem_cache *cachep, spin_unlock_irqrestore(&l3->list_lock, flags); } -static void *ac_get_obj(struct kmem_cache *cachep, struct array_cache *ac, +static void *__ac_get_obj(struct kmem_cache *cachep, struct array_cache *ac, gfp_t flags, bool force_refill) { int i; @@ -1012,7 +1014,20 @@ static void *ac_get_obj(struct kmem_cache *cachep, struct array_cache *ac, return objp; } -static void ac_put_obj(struct kmem_cache *cachep, struct array_cache *ac, +static inline void *ac_get_obj(struct kmem_cache *cachep, + struct array_cache *ac, gfp_t flags, bool force_refill) +{ + void *objp; + + if (unlikely(sk_memalloc_socks())) + objp = __ac_get_obj(cachep, ac, flags, force_refill); + else + objp = ac->entry[--ac->avail]; + + return objp; +} + +static void *__ac_put_obj(struct kmem_cache *cachep, struct array_cache *ac, void *objp) { if (unlikely(pfmemalloc_active)) { @@ -1022,6 +1037,15 @@ static void ac_put_obj(struct kmem_cache *cachep, struct array_cache *ac, set_obj_pfmemalloc(&objp); } + return objp; +} + +static inline void ac_put_obj(struct kmem_cache *cachep, struct array_cache *ac, + void *objp) +{ + if (unlikely(sk_memalloc_socks())) + objp = __ac_put_obj(cachep, ac, objp); + ac->entry[ac->avail++] = objp; }