From patchwork Wed Dec 9 16:05:31 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Whitcroft X-Patchwork-Id: 40728 X-Patchwork-Delegate: apw@canonical.com 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 1BE6DB6F2B for ; Thu, 10 Dec 2009 03:05:49 +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 1NIP2s-00062s-Jp; Wed, 09 Dec 2009 16:05:42 +0000 Received: from adelie.canonical.com ([91.189.90.139]) by chlorine.canonical.com with esmtp (Exim 4.60) (envelope-from ) id 1NIP2n-00061g-7H for kernel-team@lists.ubuntu.com; Wed, 09 Dec 2009 16:05:37 +0000 Received: from hutte.canonical.com ([91.189.90.181]) by adelie.canonical.com with esmtp (Exim 4.69 #1 (Debian)) id 1NIP2l-0001UI-07 for ; Wed, 09 Dec 2009 16:05:35 +0000 Received: from 79-66-207-78.dynamic.dsl.as9105.com ([79.66.207.78] helo=localhost.localdomain) by hutte.canonical.com with esmtpsa (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1NIP2k-0005qf-Qy for kernel-team@lists.ubuntu.com; Wed, 09 Dec 2009 16:05:34 +0000 From: Andy Whitcroft To: kernel-team@lists.ubuntu.com Subject: [PATCH 1/3] UBUNTU: SAUCE: Make populate_rootfs asynchronous Date: Wed, 9 Dec 2009 16:05:31 +0000 Message-Id: <1260374733-15526-2-git-send-email-apw@canonical.com> X-Mailer: git-send-email 1.6.3.3 In-Reply-To: <1260374733-15526-1-git-send-email-apw@canonical.com> References: <1260374733-15526-1-git-send-email-apw@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 From: Surbhi Palande The expansion of the initramfs is completely independant of other boot activities. The original data is already present at boot and the filesystem is not required until we are ready to start init. It is therefore reasonable to populate the rootfs asynchronously. Move this processing to an async call. Signed-off-by: Surbhi Palande Signed-off-by: Andy Whitcroft --- include/linux/init.h | 2 ++ init/initramfs.c | 15 ++++++++++++--- init/main.c | 6 ++++++ 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/include/linux/init.h b/include/linux/init.h index ff8bde5..b57935f 100644 --- a/include/linux/init.h +++ b/include/linux/init.h @@ -213,6 +213,8 @@ extern void (*late_time_init)(void); static initcall_t __initcall_##fn \ __used __section(.security_initcall.init) = fn +extern struct list_head populate_rootfs_domain; + struct obs_kernel_param { const char *str; int (*setup_func)(char *); diff --git a/init/initramfs.c b/init/initramfs.c index 4c00edc..b8f9e3c 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) +LIST_HEAD(populate_rootfs_domain); + +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, &populate_rootfs_domain); +} + rootfs_initcall(populate_rootfs); diff --git a/init/main.c b/init/main.c index 21d8a05..174abe4 100644 --- a/init/main.c +++ b/init/main.c @@ -879,6 +879,12 @@ static int __init kernel_init(void * unused) do_basic_setup(); /* + * We need to ensure that the filesystem is ready by this point, wait for + * async_populate_rootfs to complete. + */ + async_synchronize_full_domain(&populate_rootfs_domain); + + /* * check if there is an early userspace init. If yes, let it do all * the work */