View previous topic :: View next topic |
Author |
Message |
jordanwb l33t
Joined: 10 Jul 2008 Posts: 642 Location: Ottawa, Canada
|
Posted: Tue Oct 05, 2010 3:35 pm Post subject: [How to]Install Ureadahead |
|
|
Okay, this is my first Linux how to so I hope everything goes well.
Prerequisites
First you must patch for kernel to provide files needed for ureadahead. There are three patch files, one for <= 2.6.34 and one for =2.6.35 and one for =2.6.36:
<= 2.6.34
Code: | cd
wget http://pastebin.org/pastebin.php?dl=28573 -O 0001-trace-add-trace-events-for-open-exec-an.patch |
=2.6.35
Code: | cd
wget http://github.com/andrewthomas/kernelPatches/raw/master/ureadahead/2.6.35-gentoo_trace_events.patch -O 0001-trace-add-trace-events-for-open-exec-an.patch |
=2.6.36
Code: | cd
wget http://github.com/andrewthomas/kernelPatches/raw/master/ureadahead/2.6.36-gentoo_trace_events.patch -O 0001-trace-add-trace-events-for-open-exec-an.patch |
Applying the patch
Code: | cd /usr/src/linux
patch -p1 < ~/0001-trace-add-trace-events-for-open-exec-an.patch |
Enabling Tracing in the kernel
Go to "Kernel Hacking" and enable "Tracers (FTRACE)", in that sub-category, enable "Trace process context switches and events". Also make sure "Debug Filesystem" is enabled.
Now recompile the kernel
Installing ureadahead (and libnih)
Adding the ebuilds to your local repo (I'm assuming you have one) is pretty easy
Code: | mkdir -p /usr/local/portage/dev-libs/libnih
cd /usr/local/portage/dev-libs/libnih
wget http://pastebin.org/pastebin.php?dl=28577 -O libnih-1.0.2.ebuild
ebuild libnih-1.0.2.ebuild manifest
mkdir -p /usr/local/portage/sys-apps/ureadahead
cd /usr/local/portage/sys-apps/ureadahead
wget http://pastebin.org/pastebin.php?dl=28581 -O ureadahead-0.100.0.ebuild
ebuild ureadahead-0.100.0.ebuild manifest |
Unmask dev-libs/libnih and sys-apps/ureadahead and emerge ureadahead. By itself ureadahead won't do anything, we need to create an initscript for it:
Code: | #!/sbin/runscript
# Copyright (c) 2007-2008 Roy Marples <roy@marples.name>
# All rights reserved. Released under the 2-clause BSD license.
description="Starts Ureadahead"
depend()
{
after *
keyword -timeout
}
start()
{
ebegin "Starting Ureadahead"
if [ -f /var/lib/ureadahead/pack ]
then
/usr/sbin/ureadahead
else
/usr/sbin/ureadahead --daemon --timeout 20
fi
eend $? "Failed to start Ureadahead"
} |
(I copied the /etc/init.d/local initscript, that's why the license says what it says)
Put that in /etc/init.d/ureadahead and make it executable. Add it to the sysinit run level and you should be good to go. For some reason the maker of ureadahead (A ubuntu dev) has disabled bug reporting with this package. I do not know how this program works so I won't be of much help to you in regards to fixing stuff and error messages. If your computer takes a long time to start up change the timout value in the init script (value is in seconds)
Source code for ureadahead: https://launchpad.net/ureadahead
Source code for libnih: https://launchpad.net/libnih
The patch file included in the ureadahead-0.100.0 tarball is for 2.6.34 kernels and older. I got the patch file for 2.6.35+ kernels here: https://answers.launchpad.net/ubuntu/+source/ureadahead/+question/126222 (See Ronnie's post)
Edited 10/30/10: Thanks andrewthomas for the patch
Edited 11/01/10: Thanks again andrewthomas
Last edited by jordanwb on Mon Nov 01, 2010 7:14 pm; edited 4 times in total |
|
Back to top |
|
|
lazy_bum l33t
Joined: 16 Feb 2005 Posts: 691
|
Posted: Sun Oct 10, 2010 8:48 pm Post subject: |
|
|
Nice HOW-TO, but I'm missing some benchmark here. (-; _________________ roslin uberlay | grubelek |
|
Back to top |
|
|
jordanwb l33t
Joined: 10 Jul 2008 Posts: 642 Location: Ottawa, Canada
|
Posted: Mon Oct 11, 2010 3:30 am Post subject: |
|
|
lazy_bum wrote: | Nice HOW-TO, but I'm missing some benchmark here. (-; |
I never got a meaningful boot time improvement because compiz takes around 20 seconds to start up. I don't see it being much use on my laptop which uses a SSD |
|
Back to top |
|
|
andrewthomas Tux's lil' helper
Joined: 27 Apr 2010 Posts: 93
|
Posted: Sun Oct 31, 2010 12:11 am Post subject: |
|
|
Here is the proper patch for the 2.6.36 kernel.
Code: | wget http://github.com/andrewthomas/kernelPatches/raw/master/ureadahead/2.6.36-gentoo_trace_events.patch -O 0001-trace-add-trace-events-for-open-exec-an.patch |
|
|
Back to top |
|
|
andrewthomas Tux's lil' helper
Joined: 27 Apr 2010 Posts: 93
|
Posted: Sun Oct 31, 2010 2:49 pm Post subject: |
|
|
Jordan you put the code for the 2.6.36 kernel into the slot for the 2.6.35 kernel when you edited the first post yesterday. |
|
Back to top |
|
|
andrewthomas Tux's lil' helper
Joined: 27 Apr 2010 Posts: 93
|
Posted: Mon Nov 01, 2010 2:23 pm Post subject: |
|
|
patch for the 2.6.35 kernel.
Code: | wget http://github.com/andrewthomas/kernelPatches/raw/master/ureadahead/2.6.35-gentoo_trace_events.patch -O 0001-trace-add-trace-events-for-open-exec-an.patch |
|
|
Back to top |
|
|
ToeiRei Veteran
Joined: 03 Jan 2005 Posts: 1191 Location: Austria
|
Posted: Tue Nov 16, 2010 8:57 am Post subject: |
|
|
the ebuilds from pastebin are already pretty gone. Could someone paste working ones?
nvm. Google helped.
For the ones interested, gentoo bug #303044 _________________ Please stand by - The mailer daemon is busy burning your messages in hell... |
|
Back to top |
|
|
NerdIII n00b
Joined: 10 Oct 2010 Posts: 12
|
Posted: Sat Jul 09, 2011 3:52 am Post subject: |
|
|
Thanks! I found this looking for alternatives to preload, which just wasn't effective for me.
My system now boots 60% faster into a very responsive desktop. I have Gnome, Compiz, Opera, Pidgin and Rhythmbox start more or less simultaneous. The system used to boot fast into X, but from there on Compiz took a while and even when the desktop was loaded I was a few seconds away from seeing contents of the Gnome-Menu to start OpenOffice, an IDE, Nautilus or a terminal.
With ureadahead the boot process hangs very long on 'Initializing kernel...' (if you use a boot splash), but after that it boots as if I had a solid state drive. All the apps in the auto-start launch so quickly that I can hardly move the mouse to the menu icon before it's done.
Here is what I did and didn't do:
- The one source for everything: Bug 303044
- I patched my 2.6.38 kernel manually looking at the patch provided in the bug. (Actually these are only a few lines and a new header file.)
- I went into the kernel options and enabled Kernel Hacking -> Tracing -> Trace process context switches and events (Debug FS was selected and hidden automatically)
- Compiled and installed the kernel, no reboot required yet
- Downloaded the 'updated ebuild' for ureadahead, the libnih ebuild and also the init script (which goes into ureadahead/files) into my local portage overlay
- The usual ebuild ... digest, unmasking (portage can do this now!) and installing the ureadahead ebuild
- I DID NOT need to create the debugfs directory
- I created a sym-link of /etc/init.d/ureadahead called ureadahead.early, ureadahead.early goes into sysinit run-level, ureadahead goes into boot run-level
On the next boot ureadahead will fill the pack file for the first time. It will then update the list once every month!
To force a trace you can delete the contents of /var/lib/ureadahead, or append "gentoo=force-tracing" to the kernel line. |
|
Back to top |
|
|
NerdIII n00b
Joined: 10 Oct 2010 Posts: 12
|
Posted: Wed Jul 13, 2011 11:09 am Post subject: Updated patch for gentoo-sources-2.6.38-r6 |
|
|
Since the ureadahead patch doesn't quite match the two affected kernel source file any more I created a new one for gentoo-sources-2.6.38-r6. Apply it inside your kernel sources with "patch -p1 -i ..." and have fun
Code: | --- a/fs/exec.c
+++ b/fs/exec.c
@@ -56,6 +56,8 @@
#include <linux/pipe_fs_i.h>
#include <linux/oom.h>
+#include <trace/events/fs.h>
+
#include <asm/uaccess.h>
#include <asm/mmu_context.h>
#include <asm/tlb.h>
@@ -137,6 +139,10 @@ SYSCALL_DEFINE1(uselib, const char __use
fsnotify_open(file);
+ tmp = getname(library);
+ trace_uselib(tmp);
+ putname(library);
+
error = -ENOEXEC;
if(file->f_op) {
struct linux_binfmt * fmt;
@@ -737,6 +743,8 @@ struct file *open_exec(const char *name)
fsnotify_open(file);
+ trace_open_exec(name);
+
err = deny_write_access(file);
if (err)
goto exit;
--- a/fs/open.c
+++ b/fs/open.c
@@ -31,6 +31,9 @@
#include <linux/ima.h>
#include <linux/dnotify.h>
+#define CREATE_TRACE_POINTS
+#include <trace/events/fs.h>
+
#include "internal.h"
int do_truncate(struct dentry *dentry, loff_t length, unsigned int time_attrs,
@@ -905,6 +908,7 @@ long do_sys_open(int dfd, const char __u
} else {
fsnotify_open(f);
fd_install(fd, f);
+ trace_do_sys_open(tmp, flags, mode);
}
}
putname(tmp);
--- /dev/null
+++ b/include/trace/events/fs.h
@@ -0,0 +1,72 @@
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM fs
+
+#if !defined(_TRACE_FS_H) || defined(TRACE_HEADER_MULTI_READ)
+#define _TRACE_FS_H
+
+#include <linux/fs.h>
+#include <linux/tracepoint.h>
+
+TRACE_EVENT(do_sys_open,
+
+ TP_PROTO(char *filename, int flags, int mode),
+
+ TP_ARGS(filename, flags, mode),
+
+ TP_STRUCT__entry(
+ __string( filename, filename )
+ __field( int, flags )
+ __field( int, mode )
+ ),
+
+ TP_fast_assign(
+ __assign_str(filename, filename);
+ __entry->flags = flags;
+ __entry->mode = mode;
+ ),
+
+ TP_printk("\"%s\" %x %o",
+ __get_str(filename), __entry->flags, __entry->mode)
+);
+
+TRACE_EVENT(uselib,
+
+ TP_PROTO(char *filename),
+
+ TP_ARGS(filename),
+
+ TP_STRUCT__entry(
+ __string( filename, filename )
+ ),
+
+ TP_fast_assign(
+ __assign_str(filename, filename);
+ ),
+
+ TP_printk("\"%s\"",
+ __get_str(filename))
+);
+
+TRACE_EVENT(open_exec,
+
+ TP_PROTO(const char *filename),
+
+ TP_ARGS(filename),
+
+ TP_STRUCT__entry(
+ __string( filename, filename )
+ ),
+
+ TP_fast_assign(
+ __assign_str(filename, filename);
+ ),
+
+ TP_printk("\"%s\"",
+ __get_str(filename))
+);
+
+#endif /* _TRACE_FS_H */
+
+/* This part must be outside protection */
+#include <trace/define_trace.h>
+ |
|
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|