[merged] seq_file-allocate-seq_file-from-kmem_cache.patch removed from -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     Subject: seq_file: allocate seq_file from kmem_cache
has been removed from the -mm tree.  Its filename was
     seq_file-allocate-seq_file-from-kmem_cache.patch

This patch was dropped because it was merged into mainline or a subsystem tree

------------------------------------------------------
From: Alexey Dobriyan <adobriyan@xxxxxxxxx>
Subject: seq_file: allocate seq_file from kmem_cache

For fine-grained debugging and usercopy protection.

Link: http://lkml.kernel.org/r/20180310085027.GA17121@avx2
Signed-off-by: Alexey Dobriyan <adobriyan@xxxxxxxxx>
Reviewed-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Cc: Al Viro <viro@xxxxxxxxxxxxxxxxxx>
Cc: Glauber Costa <glommer@xxxxxxxxx>
Cc: Vladimir Davydov <vdavydov.dev@xxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 fs/seq_file.c            |   12 ++++++++++--
 include/linux/seq_file.h |    1 +
 init/main.c              |    1 +
 3 files changed, 12 insertions(+), 2 deletions(-)

diff -puN fs/seq_file.c~seq_file-allocate-seq_file-from-kmem_cache fs/seq_file.c
--- a/fs/seq_file.c~seq_file-allocate-seq_file-from-kmem_cache
+++ a/fs/seq_file.c
@@ -6,6 +6,7 @@
  * initial implementation -- AV, Oct 2001.
  */
 
+#include <linux/cache.h>
 #include <linux/fs.h>
 #include <linux/export.h>
 #include <linux/seq_file.h>
@@ -19,6 +20,8 @@
 #include <linux/uaccess.h>
 #include <asm/page.h>
 
+static struct kmem_cache *seq_file_cache __ro_after_init;
+
 static void seq_set_overflow(struct seq_file *m)
 {
 	m->count = m->size;
@@ -51,7 +54,7 @@ int seq_open(struct file *file, const st
 
 	WARN_ON(file->private_data);
 
-	p = kzalloc(sizeof(*p), GFP_KERNEL);
+	p = kmem_cache_zalloc(seq_file_cache, GFP_KERNEL);
 	if (!p)
 		return -ENOMEM;
 
@@ -366,7 +369,7 @@ int seq_release(struct inode *inode, str
 {
 	struct seq_file *m = file->private_data;
 	kvfree(m->buf);
-	kfree(m);
+	kmem_cache_free(seq_file_cache, m);
 	return 0;
 }
 EXPORT_SYMBOL(seq_release);
@@ -1106,3 +1109,8 @@ seq_hlist_next_percpu(void *v, struct hl
 	return NULL;
 }
 EXPORT_SYMBOL(seq_hlist_next_percpu);
+
+void __init seq_file_init(void)
+{
+	seq_file_cache = KMEM_CACHE(seq_file, SLAB_PANIC);
+}
diff -puN include/linux/seq_file.h~seq_file-allocate-seq_file-from-kmem_cache include/linux/seq_file.h
--- a/include/linux/seq_file.h~seq_file-allocate-seq_file-from-kmem_cache
+++ a/include/linux/seq_file.h
@@ -240,4 +240,5 @@ extern struct hlist_node *seq_hlist_star
 
 extern struct hlist_node *seq_hlist_next_percpu(void *v, struct hlist_head __percpu *head, int *cpu, loff_t *pos);
 
+void seq_file_init(void);
 #endif
diff -puN init/main.c~seq_file-allocate-seq_file-from-kmem_cache init/main.c
--- a/init/main.c~seq_file-allocate-seq_file-from-kmem_cache
+++ a/init/main.c
@@ -715,6 +715,7 @@ asmlinkage __visible void __init start_k
 	vfs_caches_init();
 	pagecache_init();
 	signals_init();
+	seq_file_init();
 	proc_root_init();
 	nsfs_init();
 	cpuset_init();
_

Patches currently in -mm which might be from adobriyan@xxxxxxxxx are

proc-revalidate-misc-dentries.patch
coredump-fix-spam-with-zero-vma-process.patch
seq_file-delete-small-value-optimization.patch

--
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux