From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753144AbbCOQQZ (ORCPT ); Sun, 15 Mar 2015 12:16:25 -0400 Received: from mout.gmx.net ([212.227.17.22]:59586 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753063AbbCOQQV (ORCPT ); Sun, 15 Mar 2015 12:16:21 -0400 From: Heinrich Schuchardt To: Andrew Morton Cc: Aaron Tomlin , Andy Lutomirski , Davidlohr Bueso , David Rientjes , "David S. Miller" , Fabian Frederick , Guenter Roeck , "H. Peter Anvin" , Ingo Molnar , Jens Axboe , Joe Perches , Johannes Weiner , Jonathan Corbet , Kees Cook , Michael Marineau , Oleg Nesterov , "Paul E. McKenney" , Peter Zijlstra , Prarit Bhargava , Rik van Riel , Rusty Russell , Steven Rostedt , Thomas Gleixner , Vladimir Davydov , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, Heinrich Schuchardt Subject: [PATCH 0/4 v6] max_threadx handling Date: Sun, 15 Mar 2015 17:13:34 +0100 Message-Id: <1426436018-5159-1-git-send-email-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.1.4 X-Provags-ID: V03:K0:ooeu56t9rqbiZp6YgTXSLcWFTpLNmqAq4zpOmas/k9SK4FevTM+ 6DP7s5WbMOtK+tu75QcAZaBIPm7QQ04R/9z300q7LlQita0ThYzE9cCsUaxJqCUb7JBRBuJ u9O/7+t6Etq8sjOWgi4Qo3exfr9EspNt6HKZ8v2TJQMa4dpD6i9FhWpjn/TlmtJKKp4gDeK bKiACtlrC4t4QR1q4RG+A== X-UI-Out-Filterresults: notjunk:1; Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. The fourth patch adds a description of threads-max to Documentation/sysctl/kernel.txt. New in version 6: Check against overflow of totalram_pages * PAGE_SIZE. Introduce argument of set_max_threads in 3rd patch where it is needed, not before. Update Documentation/sysctl/kernel.txt concerning threads-max. 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 David Rientjes Guenter Roeck Ingo Molnar Oleg Nesterov Peter Zijlstra Vladimir Davydov Heinrich Schuchardt (4): kernel/fork.c: new function for max_threads kernel/fork.c: avoid division by zero kernel/sysctl.c: threads-max observe limits Doc/sysctl/kernel.txt: document threads-max Documentation/sysctl/kernel.txt | 21 +++++++++++ include/linux/sysctl.h | 3 ++ init/main.c | 4 +-- kernel/fork.c | 78 ++++++++++++++++++++++++++++++++++------- kernel/sysctl.c | 6 ++-- 5 files changed, 93 insertions(+), 19 deletions(-) -- 2.1.4