[PATCH] ppc32: add phy excluded features to ocp_func_emac_data
[safe/jmp/linux-2.6] / mm / slab.c
index 122d031..a9ff4f7 100644 (file)
--- a/mm/slab.c
+++ b/mm/slab.c
  * is less than 512 (PAGE_SIZE<<3), but greater than 256.
  */
 
+typedef unsigned int kmem_bufctl_t;
 #define BUFCTL_END     (((kmem_bufctl_t)(~0U))-0)
 #define BUFCTL_FREE    (((kmem_bufctl_t)(~0U))-1)
 #define        SLAB_LIMIT      (((kmem_bufctl_t)(~0U))-2)
@@ -584,7 +585,8 @@ static inline struct array_cache *ac_data(kmem_cache_t *cachep)
        return cachep->array[smp_processor_id()];
 }
 
-static inline kmem_cache_t *__find_general_cachep(size_t size, int gfpflags)
+static inline kmem_cache_t *__find_general_cachep(size_t size,
+                                               unsigned int __nocast gfpflags)
 {
        struct cache_sizes *csizep = malloc_sizes;
 
@@ -599,7 +601,7 @@ static inline kmem_cache_t *__find_general_cachep(size_t size, int gfpflags)
                csizep++;
 
        /*
-        * Really subtile: The last entry with cs->cs_size==ULONG_MAX
+        * Really subtle: The last entry with cs->cs_size==ULONG_MAX
         * has cs_{dma,}cachep==NULL. Thus no special case
         * for large kmalloc calls required.
         */
@@ -608,7 +610,8 @@ static inline kmem_cache_t *__find_general_cachep(size_t size, int gfpflags)
        return csizep->cs_cachep;
 }
 
-kmem_cache_t *kmem_find_general_cachep(size_t size, int gfpflags)
+kmem_cache_t *kmem_find_general_cachep(size_t size,
+               unsigned int __nocast gfpflags)
 {
        return __find_general_cachep(size, gfpflags);
 }
@@ -2100,7 +2103,7 @@ cache_alloc_debugcheck_before(kmem_cache_t *cachep, unsigned int __nocast flags)
 #if DEBUG
 static void *
 cache_alloc_debugcheck_after(kmem_cache_t *cachep,
-                       unsigned long flags, void *objp, void *caller)
+                       unsigned int __nocast flags, void *objp, void *caller)
 {
        if (!objp)      
                return objp;
@@ -2163,7 +2166,9 @@ static inline void *__cache_alloc(kmem_cache_t *cachep, unsigned int __nocast fl
                objp = cache_alloc_refill(cachep, flags);
        }
        local_irq_restore(save_flags);
-       objp = cache_alloc_debugcheck_after(cachep, flags, objp, __builtin_return_address(0));
+       objp = cache_alloc_debugcheck_after(cachep, flags, objp,
+                                       __builtin_return_address(0));
+       prefetchw(objp);
        return objp;
 }
 
@@ -2372,6 +2377,9 @@ void *kmem_cache_alloc_node(kmem_cache_t *cachep, int flags, int nodeid)
        struct slab *slabp;
        kmem_bufctl_t next;
 
+       if (nodeid == -1)
+               return kmem_cache_alloc(cachep, flags);
+
        for (loop = 0;;loop++) {
                struct list_head *q;
 
@@ -2439,7 +2447,7 @@ got_slabp:
 }
 EXPORT_SYMBOL(kmem_cache_alloc_node);
 
-void *kmalloc_node(size_t size, int flags, int node)
+void *kmalloc_node(size_t size, unsigned int __nocast flags, int node)
 {
        kmem_cache_t *cachep;
 
@@ -3068,20 +3076,24 @@ ssize_t slabinfo_write(struct file *file, const char __user *buffer,
 }
 #endif
 
+/**
+ * ksize - get the actual amount of memory allocated for a given object
+ * @objp: Pointer to the object
+ *
+ * kmalloc may internally round up allocations and return more memory
+ * than requested. ksize() can be used to determine the actual amount of
+ * memory allocated. The caller may use this additional memory, even though
+ * a smaller amount of memory was initially specified with the kmalloc call.
+ * The caller must guarantee that objp points to a valid object previously
+ * allocated with either kmalloc() or kmem_cache_alloc(). The object
+ * must not be freed during the duration of the call.
+ */
 unsigned int ksize(const void *objp)
 {
-       kmem_cache_t *c;
-       unsigned long flags;
-       unsigned int size = 0;
-
-       if (likely(objp != NULL)) {
-               local_irq_save(flags);
-               c = GET_PAGE_CACHE(virt_to_page(objp));
-               size = kmem_cache_size(c);
-               local_irq_restore(flags);
-       }
+       if (unlikely(objp == NULL))
+               return 0;
 
-       return size;
+       return obj_reallen(GET_PAGE_CACHE(virt_to_page(objp)));
 }
 
 
@@ -3091,7 +3103,7 @@ unsigned int ksize(const void *objp)
  * @s: the string to duplicate
  * @gfp: the GFP mask used in the kmalloc() call when allocating memory
  */
-char *kstrdup(const char *s, int gfp)
+char *kstrdup(const char *s, unsigned int __nocast gfp)
 {
        size_t len;
        char *buf;