From patchwork Tue Jul 9 02:36:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 13727183 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id D32F7C3271E for ; Tue, 9 Jul 2024 02:36:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 552E66B009C; Mon, 8 Jul 2024 22:36:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4DC846B009D; Mon, 8 Jul 2024 22:36:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3326B6B009E; Mon, 8 Jul 2024 22:36:29 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 0EA646B009C for ; Mon, 8 Jul 2024 22:36:29 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id A559340511 for ; Tue, 9 Jul 2024 02:36:28 +0000 (UTC) X-FDA: 82318650456.14.F3436CC Received: from mail-ed1-f47.google.com (mail-ed1-f47.google.com [209.85.208.47]) by imf29.hostedemail.com (Postfix) with ESMTP id EA364120002 for ; Tue, 9 Jul 2024 02:36:26 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=avq6oyBi; spf=pass (imf29.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.208.47 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1720492572; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references:dkim-signature; bh=bjE8DwUrlDCrNUnU9lbz6eMDCZBVO75llm/3njyJ2S8=; b=I5UG3vCsBUl+1MV/EvUMPB06dgprE2CGD3VfsgZaqymhYLqI5Gg0THxVpDGr2hnSHgU1UC P5RH9YgWf1w6nwvRv1MeVP9dRbYpv76YJX9/xMSVn5Ksawd7BB61r7OwcF/k8zzbxYCqL5 Ae4y2Ij6NomNTpxqPgOQicZwVaWajxY= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=avq6oyBi; spf=pass (imf29.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.208.47 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1720492572; a=rsa-sha256; cv=none; b=YOW0RhrIrd54qdBT4zQC2F1WQo3be/SBoyiQ0EiKYv0U4vsUOo+ocYjceCmo0Lhx6gEOXz YV31qfs3RI6kpkG8Mn4YYNcOfI0fBbmuWC/IZhaulxZt5+Rp4jULE0rSCl4kDlxoLOQoaf +3gNeqhB/NxakKx2HyQgtdV45wbpxis= Received: by mail-ed1-f47.google.com with SMTP id 4fb4d7f45d1cf-57cb9a370ddso5777574a12.1 for ; Mon, 08 Jul 2024 19:36:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1720492585; x=1721097385; darn=kvack.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=bjE8DwUrlDCrNUnU9lbz6eMDCZBVO75llm/3njyJ2S8=; b=avq6oyBif9ah7QE4oAtfdJOEEK0Ks3KZ2f7MdNN2npOnvr4Y65jc1h7j9LYgL800Wy iVwq5B+Qg0AmiYyGR7m+poJ2jOn2OzxUMAWC+aUSurqteDW6OCG8ikqF1lLKNL5Rli97 hwqo26KPzW848lilcWEOAwTzZMUb5P9ktKSvXeb6RwMKGA56uxNUFu1xVVuBG/y7B5s4 lZn7LPsrMrLD622BdJZzqvBNYKwGd7Y6x4Ysci93694FevUJjcqRYq5EuIpoVvqebNoN UJfHAfnONMp+v44SKmMjW2LTUo1IEdtnSoTk0qiXg1hFIaVV3pNxAd4x9A5MMSFUdJ22 TSYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720492585; x=1721097385; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=bjE8DwUrlDCrNUnU9lbz6eMDCZBVO75llm/3njyJ2S8=; b=ZJg8Lv/wWWpud959SIoZC+vxyp3prfCKFUGqqy4MhlxXlLKn9UYqq+yZwvaU/oz9tl /cinSWz+WzBUG93LQ+1n9YaBMi/x/LyImqj1FiP8yYzxjwoX3KAW7Ovv9+AtjBy570he OJ6QzGsiL/LXJTYWLyTOvAeGCFr449WxfwxvkMyb5mlWtVmG9OLVddktmbxiVDfFjtpj lljxbDcd62vTnzF38d87sdYwEaZA2YI0F7/OXRiJU1os5+IbpD2/5OyhTWgsI9kgvLwg +C5rJJNW3lGPCeJuPUJxNVdieEIyd9dk5cIzndRiVQQ29bXPFuSGy6ZZqBHIXkhc/Et0 O4AQ== X-Gm-Message-State: AOJu0YxWYYzVwdaCZYYDjMYWDlVhtQLJsDcNn+g4IyyZw1RfwlDHaU+y taNprebPkfkmhXxTGQmF7Bgaauz/KFYzs0utuUxIK82IOONw0CuD X-Google-Smtp-Source: AGHT+IHjanqjTqcL0Xrni4Axg3PX3dOfKaO04+W/v8kVkKYxuwW8Byhz9w7CuaPm/tiMa9Xtq5i5xw== X-Received: by 2002:a05:6402:651:b0:585:4048:129a with SMTP id 4fb4d7f45d1cf-594bc7c81camr639810a12.31.1720492585198; Mon, 08 Jul 2024 19:36:25 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-594bc4e819bsm500496a12.51.2024.07.08.19.36.24 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 08 Jul 2024 19:36:24 -0700 (PDT) From: Wei Yang To: rppt@kernel.org, akpm@linux-foundation.org, brauner@kernel.org, oleg@redhat.com, tandersen@netflix.com, mjguzik@gmail.com Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Wei Yang Subject: [PATCH v5 3/3] kernel/fork.c: put set_max_threads()/task_struct_whitelist() in __init section Date: Tue, 9 Jul 2024 02:36:09 +0000 Message-Id: <20240709023609.21332-3-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20240709023609.21332-1-richard.weiyang@gmail.com> References: <20240709023609.21332-1-richard.weiyang@gmail.com> X-Rspamd-Server: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: EA364120002 X-Stat-Signature: f7t9htj7b6t6u7i7fh9j585jnh5yur7g X-HE-Tag: 1720492586-883706 X-HE-Meta: U2FsdGVkX1+On+gBb8SAXLGwObpfChT3KwTVDuST5dOSJPVK2WUAb4rDxjU2Wvi2XmYuSeDdNHHZ5OkzCAG/bomSJkQ6opX6LaTGjQYinMPsoq7S/T+2w3qjW3op80/pHjmSYIKfPi+UAsMmIYZ/JPUDEssfAlxWXCGIGjj8CH6dzQk198vCI0oS9vvB/H7eEZiYxb2yCYayA9AUuahX0irHQ7mJe5mSQApyKCeqaxt8ROhkmLb5NUaeeDWu6ZUV0vD5H+OQYy4mKFe5brQ4i9LimoZK4hEjByk91KFCs4Z2rR+x1Z1vJ6u3Grkil5/NFttOR5RT3h+qDR3azkFVX5XPb5bBkoELT5YRgVGA/vjVZ77Em5ifYpmz8WjqZXDloWsvzjKv+Zfm/DHRUIOUUr47f38hjqdtLAxZgqDbA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Vn6rdrIwN1cGr8mMP7yIjQwsbQ41DzkEtfIvnGxxZ5cs9SyhXk1XxwLd+4Q== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Function set_max_threads()/task_struct_whitelist() is only used by fork_init() during bootup. Let's add __init tag to them. Signed-off-by: Wei Yang Suggested-by: Oleg Nesterov --- kernel/fork.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/fork.c b/kernel/fork.c index d6c2a4ccd532..8d37c046dfeb 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -997,7 +997,7 @@ void __init __weak arch_task_cache_init(void) { } /* * set_max_threads */ -static void set_max_threads(unsigned int max_threads_suggested) +static void __init set_max_threads(unsigned int max_threads_suggested) { u64 threads; unsigned long nr_pages = memblock_estimated_nr_free_pages(); @@ -1023,7 +1023,7 @@ static void set_max_threads(unsigned int max_threads_suggested) int arch_task_struct_size __read_mostly; #endif -static void task_struct_whitelist(unsigned long *offset, unsigned long *size) +static void __init task_struct_whitelist(unsigned long *offset, unsigned long *size) { /* Fetch thread_struct whitelist for the architecture. */ arch_thread_struct_whitelist(offset, size);