Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753776AbbBRU2z (ORCPT ); Wed, 18 Feb 2015 15:28:55 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:47068 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751920AbbBRU2x (ORCPT ); Wed, 18 Feb 2015 15:28:53 -0500 Date: Wed, 18 Feb 2015 12:28:51 -0800 From: Andrew Morton To: Heinrich Schuchardt Cc: "Kirill A. Shutemov" , Peter Zijlstra , Oleg Nesterov , Rik van Riel , Vladimir Davydov , Thomas Gleixner , David Rientjes , Kees Cook , linux-kernel@vger.kernel.org, Guenter Roeck Subject: Re: [PATCH 1/1 v2] kernel/fork.c: avoid division by zero Message-Id: <20150218122851.d1ae723ff12887f9ab919431@linux-foundation.org> In-Reply-To: <54E4EC64.5010609@gmx.de> References: <1424199698-7607-1-git-send-email-xypron.glpk@gmx.de> <20150217151511.95143a25ff83c165f4199d08@linux-foundation.org> <54E4EC64.5010609@gmx.de> X-Mailer: Sylpheed 3.4.1 (GTK+ 2.24.23; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1572 Lines: 51 On Wed, 18 Feb 2015 20:47:48 +0100 Heinrich Schuchardt wrote: > Hello Andrew, > > thank you for your comments. Unfortunately there is no solution with > 32-bit calculus. How would something along the lines of if (PAGE_SIZE < THREAD_SIZE) ... else ... look? > Please, see my answers below. > > As fork_init is only called once there should be not performance issue > in using 64-bit calculus. Sure, it's not a big issue. But please do address the code comments and no "temp"! > I think that my patch did not cover all problems connected to max_threads. > > I just had a look at the memory hotplugging code. > Shouldn't max_threads and init_task.signal->rlim[RLIMIT_NPROC] be > recalculated after adding or removing memory? > This could be done in a hotplug callback. That sounds right. We've fixed some of these inaccuracies but there will be many more remaining. Searching for things like "mempages" and "nr_free_buffer_pages" shows them up. mem hotplug is an ongoing thing ;) > max_threads can be set by writing to /proc/sys/kernel/threads-max. > Shouldn't the value be checked by the same routine Probably. > and shouldn't > init_task.signal->rlim[RLIMIT_NPROC] be updated? Harder. By this time the system has all these processes which have inherited their rlimits from init. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/