OpenVZ Forum


Home » Mailing lists » Devel » [PATCH v2 00/13] Memcg Kernel Memory Tracking.
[PATCH v2 06/13] slab: Add kmem_cache_gfp_flags() helper function. [message #45813 is a reply to message #45810] Fri, 09 March 2012 20:39 Go to previous messageGo to previous message
Suleiman Souhlal is currently offline  Suleiman Souhlal
Messages: 64
Registered: February 2012
Member
This function returns the gfp flags that are always applied to
allocations of a kmem_cache.

Signed-off-by: Suleiman Souhlal <suleiman@google.com>
---
include/linux/slab_def.h | 6 ++++++
include/linux/slob_def.h | 6 ++++++
include/linux/slub_def.h | 6 ++++++
3 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/include/linux/slab_def.h b/include/linux/slab_def.h
index fbd1117..25f9a6a 100644
--- a/include/linux/slab_def.h
+++ b/include/linux/slab_def.h
@@ -159,6 +159,12 @@ found:
return __kmalloc(size, flags);
}

+static inline gfp_t
+kmem_cache_gfp_flags(struct kmem_cache *cachep)
+{
+ return cachep->gfpflags;
+}
+
#ifdef CONFIG_NUMA
extern void *__kmalloc_node(size_t size, gfp_t flags, int node);
extern void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node);
diff --git a/include/linux/slob_def.h b/include/linux/slob_def.h
index 0ec00b3..3fa527d 100644
--- a/include/linux/slob_def.h
+++ b/include/linux/slob_def.h
@@ -34,4 +34,10 @@ static __always_inline void *__kmalloc(size_t size, gfp_t flags)
return kmalloc(size, flags);
}

+static inline gfp_t
+kmem_cache_gfp_flags(struct kmem_cache *cachep)
+{
+ return 0;
+}
+
#endif /* __LINUX_SLOB_DEF_H */
diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h
index a32bcfd..5911d81 100644
--- a/include/linux/slub_def.h
+++ b/include/linux/slub_def.h
@@ -313,4 +313,10 @@ static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node)
}
#endif

+static inline gfp_t
+kmem_cache_gfp_flags(struct kmem_cache *cachep)
+{
+ return cachep->allocflags;
+}
+
#endif /* _LINUX_SLUB_DEF_H */
--
1.7.7.3
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: [PATCH v2 05/13] memcg: Reclaim when more than one page needed.
Next Topic: Re: [PATCH v2 01/13] memcg: Consolidate various flags into a single flags field.
Goto Forum:
  


Current Time: Wed Aug 27 21:40:49 GMT 2025

Total time taken to generate the page: 0.13522 seconds