Skip to content

A config option to compile out some namespaces code (v2)

Pavel Emelyanov lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest5 patches 3 repliesIn review

Changes from v1 from the cover letter

* make the NAMESPACES_EXPERIMENTAL selectable even in !EMBEDDED case

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5The config option itselfinit/Kconfig+17 -02 replies
2/5Move the UST namespace under the optioninclude/linux/utsname.h kernel/Makefile+23 -20 replies
3/5Move the IPC namespace under the optioninclude/linux/ipc.h include/linux/ipc_namespace.h ipc/Makefile +8 more+155 -1101 reply
4/5Move the user namespace under the optioninclude/linux/user_namespace.h init/Kconfig kernel/Makefile +2 more+14 -240 replies
5/5Move the PID namespace under the optioninclude/linux/pid.h include/linux/pid_namespace.h kernel/Makefile +2 more+229 -1870 replies

Reviews trailers per patch

4 of 5 patches have a Reviewed-by or Acked-by.

PatchCedric Le GoaterSerge Hallyn
1/5A-b A-b
2/5A-b
3/5A-b
4/5A-b
5/5

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/5] A config option to compile out some namespaces code (v2)

Changes from v1:
* make the NAMESPACES_EXPERIMENTAL selectable even in !EMBEDDED case

There were some questions like "do I need this on my cellphone" in reply to different namespaces patches. Indeed, the namespaces are not useful for most of the embedded systems, but the code creating and releasing them weights a lot.

So I propose to add a config option which will help embedded people to reduce the vmlinux size. This option simply compiles out the namespaces cloning and releasing code *only*, but keeps all the other logic untouched (e.g. the notion of init_ns).

When someone tries to clone some namespace with their support turned off, he will receive an EINVAL error.

This patchset can save more than 2KB from the vmlinux when turning the config option "NAMESPACES" to "n":

$ scripts/bloat-o-meter vmlinux-no-ns vmlinux-with-ns 
add/remove: 27/0 grow/shrink: 11/7 up/down: 2477/-340 (2137)
function                                     old     new   delta
copy_pid_ns                                    -     537    +537
copy_user_ns                                   -     181    +181
copy_ipcs                                      -     149    +149
zap_pid_ns_processes                           -     130    +130
copy_utsname                                   -     120    +120
shm_exit_ns                                    -     106    +106
sem_exit_ns                                    -     106    +106
msg_exit_ns                                    -     106    +106
freeary                                        -     100    +100
release_uids                                   -      95     +95
freeque                                        -      92     +92
free_nsproxy                                  48     123     +75
create_new_namespaces                        300     358     +58
free_pid_ns                                    -      56     +56
pid_namespaces_init                            -      48     +48
__sem_init_ns                                  -      45     +45
shm_init_ns                                    -      42     +42
sem_init_ns                                    -      42     +42
msg_init_ns                                    -      42     +42
__shm_init_ns                                  -      38     +38
__msg_init_ns                                  -      31     +31
sysvipc_proc_release                           5      35     +30
proc_kill_sb                                   5      35     +30
free_ipc_ns                                    -      30     +30
do_shm_rmid                                    -      29     +29
proc_set_super                                13      38     +25
shm_release                                   18      39     +21
put_pid                                       75      95     +20
alloc_pid                                    687     706     +19
pid_caches_mutex                               -      16     +16
free_user_ns                                   -      16     +16
sysvipc_proc_open                            100     111     +11
do_shmat                                     778     787      +9
pid_caches_lh                                  -       8      +8
free_uts_ns                                    -       5      +5
pid_ns_cachep                                  -       4      +4
__initcall_pid_namespaces_init6                -       4      +4
do_exit                                     1855    1856      +1
show_stat                                   1665    1661      -4
sys_shmctl                                  1934    1907     -27
msg_init                                      82      47     -35
shm_init                                      92      47     -45
sem_init                                      99      44     -55
sys_msgctl                                  1394    1311     -83
sys_semctl                                  2123    2032     -91