Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1125747pxf; Fri, 12 Mar 2021 02:32:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJwO/JEQowWKncQ3/q3trE2sXiz/+RyEVSEysv3occNrhG04PuIREbL7IK0HkhP3+xyNvssf X-Received: by 2002:a17:906:c099:: with SMTP id f25mr7960443ejz.141.1615545165716; Fri, 12 Mar 2021 02:32:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615545165; cv=none; d=google.com; s=arc-20160816; b=QQfmou+Xw+o1K31X7yVxn6Y1NsA7VFb6ir7jWRE4ykPkZ1Bpu1HYZFMy2zmWDgayT0 /zAK28dssX3UfDWq1uRwF/nH+6Z5h+MOeKNAw5hsX9lwVmEKo+025GtE2TD70lHdPVpo JQvLBwy03qHKLz7odfZQf/fFnog0IvG50uqcpcicGRA1iENG709C7kPbrxp+uwt37dXH bPpx0n4MPXmLDlkFtOtFErCN4IqJJ+toW9J9nQ1v/gV5Bl0OCmzP4oDTzP7GzY227FLn B4Pq5O8VmgwWHWP3qeyN/liQIyxt9hNvkqTwYQZXCxckmBAdbf/zTArRwUs1Wte05RJg CMeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=XECRIur2x6+f+ush3/3hqdqZ/DZoK8/+Xw6JDZbJb1s=; b=tD6CO1xqtV1MMsL/N1cxXPyuXeVboiEjujz3MY9s+DaO5DK53mgubwwryO32giaIf7 WnHGzku7lCW73MCSeDBiAo9X4FpdSZrpftQcBkAcb6rmnirTRpKzz/88iKlEwW33DzrV Ndm1AdD4CiIDxXqciby9bDI0IpyF+D0knCzYwH6cBpf2hveXEr8yzGYWdDazRC7ZCwj9 oV8CLAfKzdNDbA2r3AlEg6CYiJh68KazdOhRd9twVWIKfo/HTkA+tFhDfd1QgOFvyJhC spr747Q0LzMq5I/1JQQshITOD2LtPkCignokOnXoAQ77JdLerklMYjWmv/098m3XXaO2 JXlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=iXvvKsG0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j21si3614919edh.58.2021.03.12.02.32.23; Fri, 12 Mar 2021 02:32:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=iXvvKsG0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233318AbhCLKa4 (ORCPT + 99 others); Fri, 12 Mar 2021 05:30:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233332AbhCLKad (ORCPT ); Fri, 12 Mar 2021 05:30:33 -0500 Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B42A9C061761 for ; Fri, 12 Mar 2021 02:30:32 -0800 (PST) Received: by mail-ed1-x529.google.com with SMTP id bf3so7212827edb.6 for ; Fri, 12 Mar 2021 02:30:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=XECRIur2x6+f+ush3/3hqdqZ/DZoK8/+Xw6JDZbJb1s=; b=iXvvKsG0wwejL/9UQzwbegY9itSH0rJIMH9NW8E0Bd8mu9bUC7lTJQRmIh/1oKHpxT g5+5j676vZ9R30LLMLRGd+VKznf5heED0LVWtUv0UjCgC+H0DO+hjbwoB2ov3Kgjjy16 yBxVQWDc3xO5v6h4TkWMaqzO9gNmwPJgxNTmE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=XECRIur2x6+f+ush3/3hqdqZ/DZoK8/+Xw6JDZbJb1s=; b=fCKBO2Rz8jX9tM9/9N/hsGa/jOKIJrvIfmQ5//xuzwcJ6LoO1fqlZpJ+IKNxZXPvd+ 3pC7kH2h87H7bI/lhoG7Ki0j3yb2z2OLTwldt0cmoh2XWJNaHSDtPw5MuoNLEaL13U0E MM4WT2z/B4NptGi4FfvZhF0RfSpmYe3xiUbeiUEMti9mbjdvDf4tz6vf/67P6DKTsHBX mNncdtKJwY7ef1JDGu5m/e81nFzRGcQPJdXitoX3YICIWZxFwOmsOHf/SagMlCBl8Fki tXrlrofSCxFb4WqVyuEdwWlXkGZEeY+NWfXivymtuS02BzvEdVNdnctyT8TpMvqzFaLS CuUA== X-Gm-Message-State: AOAM531gn/0RTyNOCwkvTox95Sm8D4ivLGfh99WruMLL9lpD1HtI+g1v 9L/jqVf5womubxFwWN0WhuN5yw== X-Received: by 2002:a05:6402:35c9:: with SMTP id z9mr13277763edc.94.1615545031488; Fri, 12 Mar 2021 02:30:31 -0800 (PST) Received: from prevas-ravi.prevas.se ([80.208.71.248]) by smtp.gmail.com with ESMTPSA id r13sm2735729edy.3.2021.03.12.02.30.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Mar 2021 02:30:31 -0800 (PST) From: Rasmus Villemoes To: Greg Kroah-Hartman , "Rafael J. Wysocki" Cc: Christoph Hellwig , Rasmus Villemoes , linux-kernel@vger.kernel.org Subject: [PATCH 2/2] devtmpfs: actually reclaim some init memory Date: Fri, 12 Mar 2021 11:30:27 +0100 Message-Id: <20210312103027.2701413-2-linux@rasmusvillemoes.dk> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210312103027.2701413-1-linux@rasmusvillemoes.dk> References: <20210312103027.2701413-1-linux@rasmusvillemoes.dk> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently gcc seems to inline devtmpfs_setup() into devtmpfsd(), so its memory footprint isn't reclaimed as intended. Mark it noinline to make sure it gets put in .init.text. While here, setup_done can also be put in .init.data: After complete() releases the internal spinlock, the completion object is never touched again by that thread, and the waiting thread doesn't proceed until it observes ->done while holding that spinlock. This is now the same pattern as for kthreadd_done in init/main.c: complete() is done in a __ref function, while the corresponding wait_for_completion() is in an __init function. Signed-off-by: Rasmus Villemoes --- drivers/base/devtmpfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/base/devtmpfs.c b/drivers/base/devtmpfs.c index aedeb2dc1a18..8be352ab4ddb 100644 --- a/drivers/base/devtmpfs.c +++ b/drivers/base/devtmpfs.c @@ -371,7 +371,7 @@ int __init devtmpfs_mount(void) return err; } -static DECLARE_COMPLETION(setup_done); +static __initdata DECLARE_COMPLETION(setup_done); static int handle(const char *name, umode_t mode, kuid_t uid, kgid_t gid, struct device *dev) @@ -405,7 +405,7 @@ static void __noreturn devtmpfs_work_loop(void) } } -static int __init devtmpfs_setup(void *p) +static noinline int __init devtmpfs_setup(void *p) { int err; -- 2.29.2