Messages in this thread | | | Date | Tue, 11 Apr 2006 23:59:07 -0700 | From | Andrew Morton <> | Subject | Re: [PATCH] support for panic at OOM |
| |
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote: > > This patch adds a feature to panic at OOM, oom_die.
Makes sense I guess.
> =================================================================== > --- linux-2.6.17-rc1-mm2.orig/kernel/sysctl.c > +++ linux-2.6.17-rc1-mm2/kernel/sysctl.c > @@ -60,6 +60,7 @@ extern int proc_nr_files(ctl_table *tabl > extern int C_A_D; > extern int sysctl_overcommit_memory; > extern int sysctl_overcommit_ratio; > +extern int sysctl_oom_die; > extern int max_threads; > extern int sysrq_enabled; > extern int core_uses_pid;
One day we should create a header file for all these.
> @@ -718,6 +719,14 @@ static ctl_table vm_table[] = { > .proc_handler = &proc_dointvec, > }, > { > + .ctl_name = VM_OOM_DIE, > + .procname = "oom_die",
I'd suggest it be called "panic_on_oom". Like the current panic_on_oops.
> +int sysctl_oom_die = 0;
The initialisation is unneeded.
> +static void oom_die(void) > +{ > + panic("Panic: out of memory: oom_die is selected."); > +} > + > /** > * oom_kill - kill the "best" process when we run out of memory > * > @@ -331,6 +337,8 @@ void out_of_memory(struct zonelist *zone > > case CONSTRAINT_NONE: > retry: > + if (sysctl_oom_die) > + oom_die();
I don't think we need a separate function for this?
Please document the new sysctl in Documentation/sysctl/. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |