From: Geunsik Lim <leemgs1@gmail.com>
To: Ingo Molnar <mingo@elte.hu>, Andrew Morton <akpm@linux-foundation.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>,
Thomas Gleixner <tglx@linutronix.de>,
"H. Peter Anvin" <hpa@zytor.com>, Hugh Dickins <hughd@google.com>,
Steven Rostedt <rostedt@goodmis.org>,
Darren Hart <dvhart@linux.intel.com>,
linux-kernel <linux-kernel@vger.kernel.org>,
linux-rt-users <linux-rt-users@vger.kernel.org>
Subject: [PATCH 1/4] munmap: mem unmap operation size handling
Date: Mon, 25 Apr 2011 19:44:29 +0900 [thread overview]
Message-ID: <1303728272-11408-2-git-send-email-leemgs1@gmail.com> (raw)
In-Reply-To: <1303728272-11408-1-git-send-email-leemgs1@gmail.com>
From: Geunsik Lim <geunsik.lim@samsung.com>
The specification of H/W(cpu, memory, i/o bandwidth, etc) is different
according to their SOC. We can earn a suitable performance(or latency)
after adjust memory unmap size by selecting an optimal value to consider
specified system environment in real world.
In other words, We can get real-fast or real-time using the Linux kernel
tunable parameter choosingly for flexible memory unmap operation unit.
Signed-off-by: Geunsik Lim <geunsik.lim@samsung.com>
Acked-by: Hyunjin Choi <hj89.choi@samsung.com>
---
include/linux/munmap_unit_size.h | 24 ++++++++++++++++
mm/Makefile | 4 ++-
mm/munmap_unit_size.c | 57 ++++++++++++++++++++++++++++++++++++++
3 files changed, 84 insertions(+), 1 deletions(-)
create mode 100644 include/linux/munmap_unit_size.h
create mode 100644 mm/munmap_unit_size.c
diff --git a/include/linux/munmap_unit_size.h b/include/linux/munmap_unit_size.h
new file mode 100644
index 0000000..c4f1fd4
--- /dev/null
+++ b/include/linux/munmap_unit_size.h
@@ -0,0 +1,24 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Due to this file being licensed under the GPL there is controversy over
+ * whether this permits you to write a module that #includes this file
+ * without placing your module under the GPL. Please consult a lawyer for
+ * advice before doing this.
+ *
+ */
+
+#ifdef CONFIG_MMU
+extern unsigned long munmap_unit_size;
+extern unsigned long sysctl_munmap_unit_size;
+#else
+#define sysctl_munmap_unit_size 0UL
+#endif
+
+#ifdef CONFIG_MMU
+extern int munmap_unit_size_handler(struct ctl_table *table, int write,
+ void __user *buffer, size_t *lenp, loff_t *ppos);
+#endif
diff --git a/mm/Makefile b/mm/Makefile
index 42a8326..4b55b6c 100644
--- a/mm/Makefile
+++ b/mm/Makefile
@@ -5,7 +5,9 @@
mmu-y := nommu.o
mmu-$(CONFIG_MMU) := fremap.o highmem.o madvise.o memory.o mincore.o \
mlock.o mmap.o mprotect.o mremap.o msync.o rmap.o \
- vmalloc.o pagewalk.o pgtable-generic.o
+ vmalloc.o pagewalk.o pgtable-generic.o \
+ munmap_unit_size.o
+
obj-y := filemap.o mempool.o oom_kill.o fadvise.o \
maccess.o page_alloc.o page-writeback.o \
diff --git a/mm/munmap_unit_size.c b/mm/munmap_unit_size.c
new file mode 100644
index 0000000..1cdae1d
--- /dev/null
+++ b/mm/munmap_unit_size.c
@@ -0,0 +1,57 @@
+/*
+ * Memory Unmap Operation Unit Interface
+ * (C) Geunsik Lim, April 2011
+ */
+
+#include <linux/init.h>
+#include <linux/mm.h>
+#include <linux/munmap_unit_size.h>
+#include <linux/sysctl.h>
+
+/* amount of vm to unmap from userspace access by both Non-preemption mode
+ * and Preemption mode
+ */
+unsigned long munmap_unit_size;
+
+/*
+ * Memory unmap operation unit of vm to release allocated memory size from
+ * userspace using mmap system call
+ */
+#if !defined(CONFIG_PREEMPT_VOLUNTARY) && !defined(CONFIG_PREEMPT)
+unsigned long sysctl_munmap_unit_size = CONFIG_PREEMPT_NO_MUNMAP_RANGE;
+#else
+unsigned long sysctl_munmap_unit_size = CONFIG_PREEMPT_OK_MUNMAP_RANGE;
+#endif
+
+/*
+ * Update munmap_unit_size that changed with /proc/sys/vm/munmap_unit_size
+ * tunable value.
+ */
+static void update_munmap_unit_size(void)
+{
+ munmap_unit_size = sysctl_munmap_unit_size;
+}
+
+/*
+ * sysctl handler which just sets sysctl_munmap_unit_size = the new value
+ * and then calls update_munmap_unit_size()
+ */
+int munmap_unit_size_handler(struct ctl_table *table, int write,
+ void __user *buffer, size_t *lenp, loff_t *ppos)
+{
+ int ret;
+
+ ret = proc_doulongvec_minmax(table, write, buffer, lenp, ppos);
+
+ update_munmap_unit_size();
+
+ return ret;
+}
+
+static int __init init_munmap_unit_size(void)
+{
+ update_munmap_unit_size();
+
+ return 0;
+}
+pure_initcall(init_munmap_unit_size);
--
1.7.3.4
next prev parent reply other threads:[~2011-04-25 10:44 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-25 10:44 [PATCH 0/4] munmap: Flexible mem unmap operation interface for scheduling latency Geunsik Lim
2011-04-25 10:44 ` Geunsik Lim [this message]
2011-04-25 10:44 ` [PATCH 2/4] munmap: sysctl extension for tunable parameter Geunsik Lim
2011-04-25 10:44 ` [PATCH 3/4] munmap: kbuild menu for munmap interface Geunsik Lim
2011-04-25 15:31 ` Steven Rostedt
2011-04-26 0:40 ` Geunsik Lim
2011-04-26 0:40 ` Geunsik Lim
2011-04-25 15:45 ` Randy Dunlap
2011-04-26 0:42 ` Geunsik Lim
2011-04-26 0:42 ` Geunsik Lim
2011-04-26 22:51 ` Hugh Dickins
2011-04-27 0:07 ` Geunsik Lim
2011-04-27 0:07 ` Geunsik Lim
2011-04-25 10:44 ` [PATCH 4/4] munmap: documentation of munmap operation interface Geunsik Lim
2011-04-25 19:47 ` [PATCH 0/4] munmap: Flexible mem unmap operation interface for scheduling latency Peter Zijlstra
2011-04-25 20:29 ` Steven Rostedt
2011-04-26 7:25 ` Peter Zijlstra
2011-04-26 12:30 ` Steven Rostedt
2011-04-26 1:20 ` Geunsik Lim
2011-04-26 1:20 ` Geunsik Lim
2011-04-26 7:22 ` Peter Zijlstra
2011-04-26 23:57 ` Geunsik Lim
2011-04-26 23:57 ` Geunsik Lim
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1303728272-11408-2-git-send-email-leemgs1@gmail.com \
--to=leemgs1@gmail.com \
--cc=a.p.zijlstra@chello.nl \
--cc=akpm@linux-foundation.org \
--cc=dvhart@linux.intel.com \
--cc=hpa@zytor.com \
--cc=hughd@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rt-users@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.