From nobody Tue Oct 7 07:23:05 2025 Received: from mout-p-101.mailbox.org (mout-p-101.mailbox.org [80.241.56.151]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C20FCEEBD; Fri, 11 Jul 2025 23:04:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=80.241.56.151 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752275063; cv=none; b=IGZP/5dtv1ZF1th/W/0Iq8/mtIjfk7Un8/AiOEuCRJWxmUdQFf0J1rq0bGMyRXoHJWuOnuelEQcV8Gq+DQ44ygr7WAYqkj7S5erfobJSnKgQiH0RebxGwAILtoQmTpKf+HwPU+D/BAq1GVorZwNoRWlq1amF2yg53wprNDoE1go= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752275063; c=relaxed/simple; bh=wNvfBX4TR767dMxXw25YCG4yyWMISCgR+M2tEP4Rohw=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=iJac9uflb4RO5bdQelzuARRJYvzJ09scfpOVOvqd8ATsVZxH7KI5djJsbGrTpJPffBvs9aqVRTw/eNFsU0mW5pcC1xNQApo+ebab0lBCNIsWH6N9dSRdYL+ltb1ioHVmNYXbrc6T/kjGyaLVpdW2DBJC6r1cqq52QYoxpfdiUlg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=hauke-m.de; spf=pass smtp.mailfrom=hauke-m.de; dkim=pass (2048-bit key) header.d=hauke-m.de header.i=@hauke-m.de header.b=s7p0JKBA; arc=none smtp.client-ip=80.241.56.151 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=hauke-m.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=hauke-m.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=hauke-m.de header.i=@hauke-m.de header.b="s7p0JKBA" Received: from smtp202.mailbox.org (smtp202.mailbox.org [10.196.197.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-101.mailbox.org (Postfix) with ESMTPS id 4bf6j71fvDz9swN; Sat, 12 Jul 2025 01:04:11 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hauke-m.de; s=MBO0001; t=1752275051; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=G0dq+6kLOG7lWO2uQdL8frB6adBZ2iahZjar3rc9ltw=; b=s7p0JKBAzdzMtlvlqJCA3sH51mnc8Cs9q37D9Un7QudaQeeM8DKJeIlg+KAmPftPQJvyxb AcwUkBCxzfMFwezfVpKMy0hoU+C8niY524mAN7QK2lAat9ofBUDKnVvqy1auAucaBt3l/6 JNYHP4pOr/ePYUgWGU2kB/iIysmJQldUg3vBwZ4cCTnyjz0azvhVBg6Ptgfom4tdtbw/fM Uzypuzd3lsVBe+6B4nHFmIVK5lYmfBHT0rv7qFH/coLw7VFg60lt3TnLRem6t5UsMD3KS6 hkS5LXQ/Q1mWfbJfAbAMd7bk/01Ur+b92BNuo9ZvmySPwJiSGBa/MhO0biXQRA== From: Hauke Mehrtens To: sashal@kernel.org, linux-kernel@vger.kernel.org Cc: frederic@kernel.org, david@redhat.com, viro@zeniv.linux.org.uk, paulmck@kernel.org, Greg Kroah-Hartman , stable@vger.kernel.org, Hauke Mehrtens Subject: [PATCH] kernel/fork: Increase minimum number of allowed threads Date: Sat, 12 Jul 2025 01:03:48 +0200 Message-ID: <20250711230348.213841-1-hauke@hauke-m.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Greg Kroah-Hartman A modern Linux system creates much more than 20 threads at bootup. When I booted up OpenWrt in qemu the system sometimes failed to boot up when it wanted to create the 419th thread. The VM had 128MB RAM and the calculation in set_max_threads() calculated that max_threads should be set to 419. When the system booted up it tried to notify the user space about every device it created because CONFIG_UEVENT_HELPER was set and used. I counted 1299 calles to call_usermodehelper_setup(), all of them try to create a new thread and call the userspace hotplug script in it. This fixes bootup of Linux on systems with low memory. I saw the problem with qemu 10.0.2 using these commands: qemu-system-aarch64 -machine virt -cpu cortex-a57 -nographic Cc: stable@vger.kernel.org Signed-off-by: Hauke Mehrtens --- kernel/fork.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/fork.c b/kernel/fork.c index 7966c9a1c163..388299525f3c 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -115,7 +115,7 @@ /* * Minimum number of threads to boot the kernel */ -#define MIN_THREADS 20 +#define MIN_THREADS 600 =20 /* * Maximum number of threads --=20 2.50.1