From patchwork Mon Dec 7 17:32:06 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Surbhi Palande X-Patchwork-Id: 40517 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from chlorine.canonical.com (chlorine.canonical.com [91.189.94.204]) by ozlabs.org (Postfix) with ESMTP id 1AD56B6F14 for ; Tue, 8 Dec 2009 04:32:29 +1100 (EST) Received: from localhost ([127.0.0.1] helo=chlorine.canonical.com) by chlorine.canonical.com with esmtp (Exim 4.60) (envelope-from ) id 1NHhRh-0005TV-1L; Mon, 07 Dec 2009 17:32:25 +0000 Received: from adelie.canonical.com ([91.189.90.139]) by chlorine.canonical.com with esmtp (Exim 4.60) (envelope-from ) id 1NHhRT-0005Q2-4D for kernel-team@lists.ubuntu.com; Mon, 07 Dec 2009 17:32:11 +0000 Received: from hutte.canonical.com ([91.189.90.181]) by adelie.canonical.com with esmtp (Exim 4.69 #1 (Debian)) id 1NHhRR-0003EG-Ld for ; Mon, 07 Dec 2009 17:32:10 +0000 Received: from a88-112-252-196.elisa-laajakaista.fi ([88.112.252.196] helo=canonical.com) by hutte.canonical.com with esmtpsa (TLS-1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.69) (envelope-from ) id 1NHhRR-0007VC-CJ for kernel-team@lists.ubuntu.com; Mon, 07 Dec 2009 17:32:09 +0000 From: Surbhi Palande To: kernel-team@lists.ubuntu.com Subject: [PATCH 1/2] Populate rootfs asynchronously for boot performance Date: Mon, 7 Dec 2009 19:32:06 +0200 Message-Id: <1260207127-7736-2-git-send-email-surbhi.palande@canonical.com> X-Mailer: git-send-email 1.6.3.3 In-Reply-To: <1260207127-7736-1-git-send-email-surbhi.palande@canonical.com> References: <1260207127-7736-1-git-send-email-surbhi.palande@canonical.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.8 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: kernel-team-bounces@lists.ubuntu.com Errors-To: kernel-team-bounces@lists.ubuntu.com populate_rootfs() is called asynchronously to reduce the boot time. Signed-off-by: Surbhi Palande --- init/initramfs.c | 15 ++++++++++++--- init/main.c | 7 +++++++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/init/initramfs.c b/init/initramfs.c index 4c00edc..aad2c28 100644 --- a/init/initramfs.c +++ b/init/initramfs.c @@ -8,6 +8,7 @@ #include #include #include +#include static __initdata char *message; static void __init error(char *x) @@ -565,7 +566,9 @@ static void __init clean_rootfs(void) } #endif -static int __init populate_rootfs(void) +extern struct list_head rootfs_fn_list; + +static void __init async_populate_rootfs(void) { char *err = unpack_to_rootfs(__initramfs_start, __initramfs_end - __initramfs_start); @@ -579,7 +582,7 @@ static int __init populate_rootfs(void) initrd_end - initrd_start); if (!err) { free_initrd(); - return 0; + return; } else { clean_rootfs(); unpack_to_rootfs(__initramfs_start, @@ -603,6 +606,12 @@ static int __init populate_rootfs(void) free_initrd(); #endif } - return 0; + return; } + +static int __init populate_rootfs(void) +{ + async_schedule_domain(async_populate_rootfs, NULL, &rootfs_fn_list); +} + rootfs_initcall(populate_rootfs); diff --git a/init/main.c b/init/main.c index 4051d75..d40ca6f 100644 --- a/init/main.c +++ b/init/main.c @@ -752,6 +752,7 @@ int do_one_initcall(initcall_t fn) extern initcall_t __initcall_start[], __initcall_end[], __early_initcall_end[]; +LIST_HEAD(rootfs_fn_list); static void __init do_initcalls(void) { @@ -879,6 +880,12 @@ static int __init kernel_init(void * unused) do_basic_setup(); /* + * putting it here to ensure that rootfs is populated by the end of + * this call + */ + async_synchronize_full_domain(&rootfs_fn_list); + + /* * check if there is an early userspace init. If yes, let it do all * the work */