--- old/include/linux/ve.h 2010-04-30 16:18:15.000000000 +0400 +++ new/include/linux/ve.h 2010-04-30 17:39:02.000000000 +0400 @@ -321,6 +321,7 @@ struct ve_struct { unsigned char sparse_vpid; struct pidmap ve_pidmap[PIDMAP_ENTRIES]; int last_vpid; + int pid_max; struct ve_monitor *monitor; struct proc_dir_entry *monitor_proc; unsigned long meminfo_val; --- old/kernel/pid.c 2010-04-30 16:18:14.000000000 +0400 +++ new/kernel/pid.c 2010-04-30 20:42:02.000000000 +0400 @@ -196,6 +196,7 @@ static void free_vpidmap(struct ve_struc static int alloc_vpidmap(struct ve_struct *ve) { int i, offset, max_scan, vpid, last = ve->last_vpid; + int pid_max = ve->pid_max; pidmap_t *map; vpid = last + 1; --- old/kernel/sysctl.c 2010-04-30 16:18:14.000000000 +0400 +++ new/kernel/sysctl.c 2010-04-30 20:52:00.000000000 +0400 @@ -197,6 +197,8 @@ extern int no_unaligned_warning; extern int max_lock_depth; #endif #ifdef CONFIG_VE +static int proc_do_pid_string(ctl_table *table, int write, struct file *filp, + void __user *buffer, size_t *lenp, loff_t *ppos); int glob_ve_meminfo = 0; EXPORT_SYMBOL(glob_ve_meminfo); #endif @@ -856,6 +858,7 @@ static ctl_table kern_table[] = { .proc_handler = &fsch_sysctl_latency }, #endif +#ifndef CONFIG_VE { .ctl_name = KERN_PIDMAX, .procname = "pid_max", @@ -867,8 +870,21 @@ static ctl_table kern_table[] = { .extra1 = &pid_max_min, .extra2 = &pid_max_max, }, +#endif #ifdef CONFIG_VE { + .ctl_name = KERN_PIDMAX, + .procname = "pid_max", + .data = NULL, + .maxlen = sizeof (int), + .mode = 0644, + .proc_handler = &proc_do_pid_string, + .strategy = sysctl_intvec, + .extra1 = &pid_max_min, + .extra2 = &pid_max_max, + .virt_handler = 1, + }, + { .ctl_name = KERN_VIRT_PIDS, .procname = "virt_pids", .data = &glob_virt_pids, @@ -2946,6 +2962,37 @@ proc_minmax: } #endif +#ifdef CONFIG_VE +static int proc_do_pid_string(ctl_table *table, int write, struct file *filp, + void __user *buffer, size_t *lenp, loff_t *ppos) +{ + void *data; + struct ve_struct *ve; + struct do_proc_dointvec_minmax_conv_param param = { + .min = (int *) table->extra1, + .max = (int *) table->extra2, + }; + + ve = get_exec_env(); + + switch (table->ctl_name) { + case KERN_PIDMAX: + if (ve_is_super(ve)) + data = &pid_max; + else { + data = &ve->pid_max; + ve->sparse_vpid = 1; + } + break; + default: + return -EINVAL; + } + return __do_proc_dointvec(data, table, write, filp, buffer, + lenp, ppos, do_proc_dointvec_minmax_conv, ¶m); + +} +#endif + #else /* CONFIG_PROC_FS */ int proc_dostring(ctl_table *table, int write, struct file *filp, @@ -2975,6 +3022,14 @@ static int proc_do_ipc_string(ctl_table } #endif +#ifdef CONFIG_VE +static int proc_do_pid_string(ctl_table *table, int write, struct file *filp, + void __user *buffer, size_t *lenp, loff_t *ppos) +{ + return -ENOSYS; +} +#endif + int proc_dointvec(ctl_table *table, int write, struct file *filp, void __user *buffer, size_t *lenp, loff_t *ppos) { --- old/kernel/ve/vecalls.c 2010-04-30 16:18:15.000000000 +0400 +++ new/kernel/ve/vecalls.c 2010-04-30 17:46:34.000000000 +0400 @@ -1096,6 +1096,7 @@ static int init_ve_struct(struct ve_stru ve->start_jiffies = get_jiffies_64(); ve->start_cycles = get_cycles(); ve->virt_pids = glob_virt_pids; + ve->pid_max = PID_MAX_DEFAULT; INIT_LIST_HEAD(&ve->vetask_auxlist); ve->_randomize_va_space = ve0._randomize_va_space;