FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Ubuntu > Ubuntu Kernel Team

 
 
LinkBack Thread Tools
 
Old 12-07-2009, 05:15 PM
Andy Whitcroft
 
Default Populate rootfs asynchronously and early

On Mon, Dec 07, 2009 at 07:32:05PM +0200, Surbhi Palande wrote:
> These patches populate the rootfs asynchronously and early to improve the
> boot performance. They are tested against a 2.6.32 kernel on KVM and Dell
> Mini 10v. On a Dell Mini 10v, it was observed that the boot performance
> improved by 0.35 ms with the 1st patch and by 0.37 ms with the 1st and
> the 2nd patch together.

0.35s and 0.37s I assume.

> More testing from a wider audience will be appreciated.
>
> Originally populate_rootfs() did not return any error code and hence
> could be safely converted to a void function. async_synchronize_domain()
> is called immediately after do_basic_setup() so that we wait only for
> the completion of populate_rootfs and not the other functions.

-apw

--
kernel-team mailing list
kernel-team@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/kernel-team
 
Old 12-08-2009, 08:44 AM
Surbhi Palande
 
Default Populate rootfs asynchronously and early

These patches populate the rootfs asynchronously and early to improve the
boot performance. They are tested against a 2.6.32 kernel on KVM and Dell
Mini 10v. On a Dell Mini 10v, it was observed that the boot performance
improved by 0.35 s with the 1st patch and by 0.37 s with the 1st and
the 2nd patch together.

The 2nd patch starts the population of the rootfs as soon as the cores are
up and the asynchronous calls are available for use. This patch might reduce
the boot time, but this needs verification. On a Dell Mini 10v, the 2nd patch
gave an additional boot performance improvement of only 0.2s.

More testing from a wider audience will be appreciated.

Originally populate_rootfs() did not return any error code and hence
could be safely converted to a void function. async_synchronize_domain()
is called immediately after do_basic_setup() so that we wait only for
the completion of populate_rootfs and not the other functions.

The following changes since commit 41ff170f0e6769813433090444b14a2e33477fcd:
Andy Whitcroft (1):
UBUNTU: Start new release

are available in the git repository at:

git://kernel.ubuntu.com/surbhi/ubuntu-lucid.git asyncrootfs

Surbhi Palande (2):
Populate rootfs asynchronously for boot performance
Start the population of rootfs early during boot

include/asm-generic/vmlinux.lds.h | 1 +
include/linux/init.h | 3 +++
init/initramfs.c | 17 +++++++++++++----
init/main.c | 6 ++++++
4 files changed, 23 insertions(+), 4 deletions(-)


--
kernel-team mailing list
kernel-team@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/kernel-team
 
Old 12-08-2009, 08:44 AM
Surbhi Palande
 
Default Populate rootfs asynchronously and early

populate_rootfs() is called asynchronously to reduce the boot time.

Signed-off-by: Surbhi Palande <surbhi.palande@canonical.com>
---
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 <linux/dirent.h>
#include <linux/syscalls.h>
#include <linux/utime.h>
+#include <linux/async.h>

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 28bc963..3b74ddf 100644
--- a/init/main.c
+++ b/init/main.c
@@ -884,6 +884,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_dom ain);
+
+ /*
* check if there is an early userspace init. If yes, let it do all
* the work
*/
--
1.6.3.3


--
kernel-team mailing list
kernel-team@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/kernel-team
 
Old 12-08-2009, 08:44 AM
Surbhi Palande
 
Default Populate rootfs asynchronously and early

Starting the asynchronous population of rootfs early in
the boot sequence might reduce the boot time.

Signed-off-by: Surbhi Palande <surbhi.palande@canonical.com>
---
include/asm-generic/vmlinux.lds.h | 1 +
include/linux/init.h | 1 +
init/initramfs.c | 2 +-
3 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index b6e818f..d4db519 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -584,6 +584,7 @@
*(.initcall0.init)
*(.initcall0s.init)
*(.initcall1.init)
+ *(.initcallearlyrootfs.init)
*(.initcall1s.init)
*(.initcall2.init)
*(.initcall2s.init)
diff --git a/include/linux/init.h b/include/linux/init.h
index b57935f..4aeb7bd 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -185,6 +185,7 @@ extern void (*late_time_init)(void);
#define pure_initcall(fn) __define_initcall("0",fn,0)

#define core_initcall(fn) __define_initcall("1",fn,1)
+#define earlyrootfs_initcall(fn) __define_initcall("earlyrootfs",fn,rootfs)
#define core_initcall_sync(fn) __define_initcall("1s",fn,1s)
#define postcore_initcall(fn) __define_initcall("2",fn,2)
#define postcore_initcall_sync(fn) __define_initcall("2s",fn,2s)
diff --git a/init/initramfs.c b/init/initramfs.c
index b8f9e3c..b04c274 100644
--- a/init/initramfs.c
+++ b/init/initramfs.c
@@ -614,4 +614,4 @@ static int __init populate_rootfs(void)
async_schedule_domain(async_populate_rootfs, NULL, &populate_rootfs_domain);
}

-rootfs_initcall(populate_rootfs);
+earlyrootfs_initcall(populate_rootfs);
--
1.6.3.3


--
kernel-team mailing list
kernel-team@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/kernel-team
 
Old 12-08-2009, 06:07 PM
Andy Whitcroft
 
Default Populate rootfs asynchronously and early

On Tue, Dec 08, 2009 at 11:44:33AM +0200, Surbhi Palande wrote:
> These patches populate the rootfs asynchronously and early to improve the
> boot performance. They are tested against a 2.6.32 kernel on KVM and Dell
> Mini 10v. On a Dell Mini 10v, it was observed that the boot performance
> improved by 0.35 s with the 1st patch and by 0.37 s with the 1st and
> the 2nd patch together.
>
> The 2nd patch starts the population of the rootfs as soon as the cores are
> up and the asynchronous calls are available for use. This patch might reduce
> the boot time, but this needs verification. On a Dell Mini 10v, the 2nd patch
> gave an additional boot performance improvement of only 0.2s.

I put these patches to some tests in combination with an additional patch
of my own to make isapnp_init asyncronous. All test kernels are from
the same base lucid kernel version for comparability. Three patches
are tested:

async_populate_rootfs: an early version of 1/2 here which pushed
populate_rootfs out to an sync function but leaves it in the original
start location,
async_isapnp: which pushed the isapnp_init call out of line to async,
again in the original location, and
earlyrootfs: which represents 2/2 here which pushes the start of the
initramfs decode as early as possible.

The combinations tested are as below:

test1: virgin lucid kernel,
test2: virgin + async_populate_rootfs,
test3: virgin + async_populate_rootfs + async_isapnp,
test4: virgin + async_populate_rootfs + async_isapnp + earlyrootfs.

These were then tested on three machines, the reference Dell Mini 10v
(ssd), a Dell 1537, and an amd64 uni-processor system. The link below
points to some comparitive graphs for these tests:

http://people.canonical.com/~apw/boot-speed/index.html

The overall kernel initialisation time can be seen in the table below.
It should be noted that the variance in results is reasaonably high so
these figures should only be considers in broad terms:

| Dell 10v | Dell 1537 | amd64-up |
| test1 | 1.48 | 1.34 | 1.95 |
| test2 | 1.11 | 1.15 | 1.75 |
| test3 | 0.87 | 1.16 | 1.75 |
| test4 | 0.87 | 1.17 | 1.95 |

What is clear is that making populate_initramfs async is worth a good
deal of time, as is making isapnp_init async. Moving the init of the
initramfs earlier is a basically worth nothing on SMP boxes and a severe
negative on UP systems.

From these numbers I would recommend that we add the async_populate_rootfs
and async_isapnp patches for Lucid, and keeping the earlyrootfs in our
back pocket; likely we would need to make it conditional on the machine
being SMP for it to be of use and only then should the rest of kernel
init mean we are waiting on this.

Caveat: it should also be noted that the isapnp_init being async has not
been tested with any actual ISA devices present, and would require testing.

Finally anyone wishing to perform these tests on a machine of interest,
perhaps one with ISA, can get the kernels used for this testing at the
URL below. Please boot each of the four kernels with these additional
kernel command line options 'initcall_debug printk.time=1' and collect
a dmesg output immediatly after boot, send all four to me and I will add
them to the results. Test kernels are here:

http://people.canonical.com/~apw/async-init-lucid/

-apw

--
kernel-team mailing list
kernel-team@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/kernel-team
 
Old 12-08-2009, 06:13 PM
Andy Whitcroft
 
Default Populate rootfs asynchronously and early

On Tue, Dec 08, 2009 at 11:44:34AM +0200, Surbhi Palande wrote:
> populate_rootfs() is called asynchronously to reduce the boot time.

This comment I made on a previous version, but it got lost in my last
round of comments so I repeat it here:

This could do with some more words of explanation. We should be telling
them why this is true and why it is safe.

"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."

-apw

--
kernel-team mailing list
kernel-team@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/kernel-team
 
Old 12-08-2009, 06:42 PM
Scott James Remnant
 
Default Populate rootfs asynchronously and early

On Tue, 2009-12-08 at 19:13 +0000, Andy Whitcroft wrote:

> On Tue, Dec 08, 2009 at 11:44:34AM +0200, Surbhi Palande wrote:
> > populate_rootfs() is called asynchronously to reduce the boot time.
>
> This comment I made on a previous version, but it got lost in my last
> round of comments so I repeat it here:
>
> This could do with some more words of explanation. We should be telling
> them why this is true and why it is safe.
>
> "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."
>
It's worth pointing out that the upstream kernel folks probably won't
agree with this straight away.

Part of the original goal of the initramfs was that the kernel might
actually want to call out to it for its own init purposes before
actually passing over to it's real init.

Their usual example is things like firmware loading, or that crazy
kernel-calls-modprobe stuff that won me the Dell Tablet


The simple fact is that it never worked, because there's more to making
the initramfs *ready* than just unpacking it. We need filesystems
like /proc and /sys mounted in it, we need to run depmod inside it (so
that modprobe works), you need udev running to process firmware
requests, etc.


Having populate_rootfs() synchronous makes sense for the *original*
design goals of the initramfs (vs. initrd). However since no userspace
ever implemented it that way, and things have moved on since then with
regards to kernel/userspace communication, if you were doing it now
you'd make it async. Which we've done.

This may take some arguing upstream.

Plus you can guarantee that certain Dutch-born Intel people will stick
their oar in about how it's not worth accepting the patch because you
shouldn't have an initramfs anyway.

Scott
--
Scott James Remnant
scott@ubuntu.com
--
kernel-team mailing list
kernel-team@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/kernel-team
 
Old 12-08-2009, 07:05 PM
Scott James Remnant
 
Default Populate rootfs asynchronously and early

On Tue, 2009-12-08 at 19:07 +0000, Andy Whitcroft wrote:

> These were then tested on three machines, the reference Dell Mini 10v
> (ssd), a Dell 1537, and an amd64 uni-processor system. The link below
> points to some comparitive graphs for these tests:
>
I've tested the "test4" kernel on the Mini 10v, with the full boot,
here's now the budget changes compare:

| Kernel |
+---------+---------+
| vanilla | 4.12s |
| test4 | 3.61s |
+---------+---------+
| -0.51s |


I then added that EDID caching patch I keep going on about:

| Kernel |
+---------+---------+
| test4 | 3.61s |
| edid | 3.40s |
+---------+---------+
| -0.21s |

Both changes together would take 0.7s off the budget. Have attached
that bootchart.

Much of the remaining time is in those modprobe calls, the majority of
which is the i915 module I believe. We lose just over a second for
having to sleep for that to turn up, so we can display the splash
screen.

Scott
--
Scott James Remnant
scott@ubuntu.com
--
kernel-team mailing list
kernel-team@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/kernel-team
 
Old 12-08-2009, 08:14 PM
Andy Whitcroft
 
Default Populate rootfs asynchronously and early

On Tue, Dec 08, 2009 at 07:42:47PM +0000, Scott James Remnant wrote:

> Part of the original goal of the initramfs was that the kernel might
> actually want to call out to it for its own init purposes before
> actually passing over to it's real init.
>
> Their usual example is things like firmware loading, or that crazy
> kernel-calls-modprobe stuff that won me the Dell Tablet
>
>
> The simple fact is that it never worked, because there's more to making
> the initramfs *ready* than just unpacking it. We need filesystems
> like /proc and /sys mounted in it, we need to run depmod inside it (so
> that modprobe works), you need udev running to process firmware
> requests, etc.
>
>
> Having populate_rootfs() synchronous makes sense for the *original*
> design goals of the initramfs (vs. initrd). However since no userspace
> ever implemented it that way, and things have moved on since then with
> regards to kernel/userspace communication, if you were doing it now
> you'd make it async. Which we've done.
>
> This may take some arguing upstream.
>
> Plus you can guarantee that certain Dutch-born Intel people will stick
> their oar in about how it's not worth accepting the patch because you
> shouldn't have an initramfs anyway.

Yeah, the nice thing about the _domain approach is that the first
consumer of the initramfs can wait for it then.

The other thing we can do is to make this a configurable option so that
distros can opt-in as appropriate.

-apw

--
kernel-team mailing list
kernel-team@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/kernel-team
 

Thread Tools




All times are GMT. The time now is 09:46 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org