Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752916AbbBWVtU (ORCPT ); Mon, 23 Feb 2015 16:49:20 -0500 Received: from mx1.redhat.com ([209.132.183.28]:42653 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751995AbbBWVtT (ORCPT ); Mon, 23 Feb 2015 16:49:19 -0500 Date: Mon, 23 Feb 2015 22:46:35 +0100 From: Oleg Nesterov To: Heinrich Schuchardt Cc: Andrew Morton , 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 , Kees Cook , Michael Marineau , "Paul E. McKenney" , Peter Zijlstra , Prarit Bhargava , Rik van Riel , Rusty Russell , Steven Rostedt , Thomas Gleixner , Vladimir Davydov , linux-kernel@vger.kernel.org Subject: Re: [PATCH 4/4 v4] kernel/fork.c: memory hotplug updates max_threads Message-ID: <20150223214635.GA29048@redhat.com> References: <20150222075825.GA20626@gmail.com> <1424722477-23758-1-git-send-email-xypron.glpk@gmx.de> <1424722477-23758-5-git-send-email-xypron.glpk@gmx.de> <20150223205052.GA26955@redhat.com> <20150223205412.GB26955@redhat.com> <54EB9781.504@gmx.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <54EB9781.504@gmx.de> User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1773 Lines: 50 On 02/23, Heinrich Schuchardt wrote: > > On 23.02.2015 21:54, Oleg Nesterov wrote: > > > >> And it changes the swapper/0's rlimits. This is pointless after we fork > >> /sbin/init. > > So should writing to /proc/sys/max_threads update the limits of all > processes? Why? No, I think it should not touch rlimits at all. > >> It seems to me these patches need some cleanups. Plus I am not sure the > >> kernel should update max_threads automatically, we have the "threads-max" > >> sysctl. > > The idea in the original version of fork_init is that max_threads should > be chosen such that the memory needed to store the meta-information of > max_threads threads should only be 1/8th of the total memory. > > Somebody adding or removing memory will not necessarily update > /proc/sys/kernel/threads-max. > > This means that if I remove 90 % of the memory I get to a situation > where max_threads allows so many threads to be created that the > meta-information occupies all memory. > > With patch 4/4 max_threads is automatically reduced in this case. I understand. But I think that if you remove 90 % of the memory you can also update /proc/sys/kernel/threads-max. And, suppose that admin specially limited max_threads, then you add more memory. Should the kernel bump the limit silently? And if hotplug should update max_threads, why it doesn't update, say, files_stat.max_files? IOW, I do not think that kernel should control max_threads after boot. But I won't really argue. Just this looks a bit strange to me. Oleg. -- 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/