Skip to contentSkip to conversation

sysctl: Make kernel.ns_last_pid control being CHECKPOINT_RESTORE dependent

PATCH New Cyrill Gorcunov 1 participant 1 message Jan 13, 2012 Namespaces:

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sysctl: Make kernel.ns_last_pid control being CHECKPOINT_RESTORE dependent

For those who doesn't need C/R functionality there is no need to control last pid, ie the pid for the next fork() call.

CC Pavel Emelyanov <[email protected]>
CC Tejun Heo <[email protected]>
CC Oleg Nesterov <[email protected]>
CC Andrew Morton <[email protected]>

---

Since there only two places where CONFIG_ is needed, I think plain #ifdef better than some helper function with bare body and unconditional call.

 kernel/pid_namespace.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
kernel/pid_namespace.c +5 -1
Index: linux-2.6.git/kernel/pid_namespace.c
===================================================================
@@ -191,6 +191,7 @@ void zap_pid_ns_processes(struct pid_nam
 	return;
 }
 
+#ifdef CONFIG_CHECKPOINT_RESTORE
 static int pid_ns_ctl_handler(struct ctl_table *table, int write,
 		void __user *buffer, size_t *lenp, loff_t *ppos)
 {
@@ -218,13 +219,16 @@ static struct ctl_table pid_ns_ctl_table
 	},
 	{ }
 };
-
 static struct ctl_path kern_path[] = { { .procname = "kernel", }, { } };
+#endif /* CONFIG_CHECKPOINT_RESTORE */
 
 static __init int pid_namespaces_init(void)
 {
 	pid_ns_cachep = KMEM_CACHE(pid_namespace, SLAB_PANIC);
+
+#ifdef CONFIG_CHECKPOINT_RESTORE
 	register_sysctl_paths(kern_path, pid_ns_ctl_table);
+#endif
 	return 0;
 }