linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] [mm] limit the min_free_kbytes
@ 2008-05-21  9:34 Li Yang, Kong Wei
  2008-05-21  9:46 ` Alan Cox
  0 siblings, 1 reply; 2+ messages in thread
From: Li Yang, Kong Wei @ 2008-05-21  9:34 UTC (permalink / raw)
  To: linux-mm; +Cc: linux-kernel, Kong Wei

Unlimited of min_free_kbytes is dangerous,
An user of our company set this value bigger than 3584*1024*K,
cause the system OOM on DMA.
And I try a even more bigger number will cause the system hang immediately.
Limited as 64M may not a good value, but as default in init_per_zone_pages_min.
And this option may not need again?

Signed-off-by: Kong Wei <weikong@redflag-linux.com>
---
 kernel/sysctl.c |    5 ++++-
 mm/page_alloc.c |    2 +-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 8b7e954..d052522 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -103,6 +103,8 @@ static int minolduid;
 static int min_percpu_pagelist_fract = 8;
 
 static int ngroups_max = NGROUPS_MAX;
+static int min_min_free_kbytes = 128;
+static int max_min_free_kbytes = 65536;
 
 #ifdef CONFIG_KMOD
 extern char modprobe_path[];
@@ -1010,7 +1012,8 @@ static struct ctl_table vm_table[] = {
 		.mode		= 0644,
 		.proc_handler	= &min_free_kbytes_sysctl_handler,
 		.strategy	= &sysctl_intvec,
-		.extra1		= &zero,
+		.extra1		= &min_min_free_kbytes,
+		.extra2		= &max_min_free_kbytes,
 	},
 	{
 		.ctl_name	= VM_PERCPU_PAGELIST_FRACTION,
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 75b9793..52979e9 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -4179,7 +4179,7 @@ module_init(init_per_zone_pages_min)
 int min_free_kbytes_sysctl_handler(ctl_table *table, int write, 
 	struct file *file, void __user *buffer, size_t *length, loff_t *ppos)
 {
-	proc_dointvec(table, write, file, buffer, length, ppos);
+	proc_dointvec_minmax(table, write, file, buffer, length, ppos);
 	if (write)
 		setup_per_zone_pages_min();
 	return 0;
-- 
1.5.0.3

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] [mm] limit the min_free_kbytes
  2008-05-21  9:34 [PATCH] [mm] limit the min_free_kbytes Li Yang, Kong Wei
@ 2008-05-21  9:46 ` Alan Cox
  0 siblings, 0 replies; 2+ messages in thread
From: Alan Cox @ 2008-05-21  9:46 UTC (permalink / raw)
  To: Li Yang; +Cc: linux-mm, linux-kernel, Kong Wei

On Wed, 21 May 2008 17:34:41 +0800
Li Yang <leoli@freescale.com> wrote:

> From: Kong Wei <weikong@redflag-linux.com>
> 
> Unlimited of min_free_kbytes is dangerous,
> An user of our company set this value bigger than 3584*1024*K,
> cause the system OOM on DMA.

You need to be root to set this value, and as root you could equally just
type "halt", run a real time process in a tight loop or reformat the hard
disk.

NAK this patch

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-05-21  9:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-21  9:34 [PATCH] [mm] limit the min_free_kbytes Li Yang, Kong Wei
2008-05-21  9:46 ` Alan Cox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).