]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - mm/slab_common.c
Merge branch 'slab/next' into for-next
[karo-tx-linux.git] / mm / slab_common.c
index ff3218a0f5e14029aab5c23dd323f447d2a86173..6a2e530cd7270848010a48ff22ab0f07ad7ea21c 100644 (file)
@@ -373,8 +373,10 @@ struct kmem_cache *kmalloc_slab(size_t size, gfp_t flags)
 {
        int index;
 
-       if (WARN_ON_ONCE(size > KMALLOC_MAX_SIZE))
+       if (size > KMALLOC_MAX_SIZE) {
+               WARN_ON_ONCE(!(flags & __GFP_NOWARN));
                return NULL;
+       }
 
        if (size <= 192) {
                if (!size)
@@ -495,6 +497,13 @@ void __init create_kmalloc_caches(unsigned long flags)
 
 
 #ifdef CONFIG_SLABINFO
+
+#ifdef CONFIG_SLAB
+#define SLABINFO_RIGHTS (S_IWUSR | S_IRUSR)
+#else
+#define SLABINFO_RIGHTS S_IRUSR
+#endif
+
 void print_slabinfo_header(struct seq_file *m)
 {
        /*
@@ -529,12 +538,12 @@ static void *s_start(struct seq_file *m, loff_t *pos)
        return seq_list_start(&slab_caches, *pos);
 }
 
-static void *s_next(struct seq_file *m, void *p, loff_t *pos)
+void *s_next(struct seq_file *m, void *p, loff_t *pos)
 {
        return seq_list_next(p, &slab_caches, pos);
 }
 
-static void s_stop(struct seq_file *m, void *p)
+void s_stop(struct seq_file *m, void *p)
 {
        mutex_unlock(&slab_mutex);
 }
@@ -631,7 +640,8 @@ static const struct file_operations proc_slabinfo_operations = {
 
 static int __init slab_proc_init(void)
 {
-       proc_create("slabinfo", S_IRUSR, NULL, &proc_slabinfo_operations);
+       proc_create("slabinfo", SLABINFO_RIGHTS, NULL,
+                                               &proc_slabinfo_operations);
        return 0;
 }
 module_init(slab_proc_init);