[PATCH 0/3 v5] max_threadx handling

Heinrich Schuchardt
2015-02-24T19:39:24Z

In fork_init a division by zero may occur.

In the first patch the calculation of max_threads is moved from fork_init
to a new separate function.

The incorrect calculation of max threads is addressed in the
second patch.

Furthermore max_threads is checked against FUTEX_TID_MASK.

The third patch addresses max_threads being set by writing to
/proc/sys/kernel/threads-max. The same limits are applied as
in fork_init.

New in version 5:
Do not update limits of the init process
Do not update max_threads on memory hotplug events
Corrections to commit messages

New in version 4:
Separation of refactoring and correction into separate patches
(as requested by Ingo Molnar)
Remove redundant argument of fork_init

New in version 3:
Determination of max_threads moved to separate function.
Handling of /proc/sys/kernel/threads-max
Handling of memory hotplugging.

New in version 2:
Use div64_u64 for 64-bit division.

Thank you for your helpful feedback:
Andrew Morton <akpm@linux-foundation.org>
Guenter Roeck <linux@roeck-us.net>
Ingo Molnar <mingo@kernel.org>
Oleg Nesterov <oleg@redhat.com>
Peter Zijlstra <peterz@infradead.org>
Vladimir Davydov <vdavydov@parallels.com>

Heinrich Schuchardt (3):
kernel/fork.c: new function for max_threads
kernel/fork.c: avoid division by zero
kernel/sysctl.c: threads-max observe limits

include/linux/sysctl.h | 3 ++
init/main.c | 4 +--
kernel/fork.c | 75 +++++++++++++++++++++++++++++++++++++++++---------
kernel/sysctl.c | 6 ++--
4 files changed, 69 insertions(+), 19 deletions(-)

--
2.1.4