diff options
author | austin <austin@azhang.bj.intel.com> | 2008-11-07 05:01:12 -0500 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2008-12-01 20:40:32 +0000 |
commit | 6f7afab062b81ee8822dd2ac84e4f44608fa17be (patch) | |
tree | 1114043f38180468e367b9e81c301465f82c6e29 /meta-moblin/packages/sreadahead | |
parent | 0c2a3df77b1afee479e60aca02f44acce4e04e45 (diff) | |
download | poky-6f7afab062b81ee8822dd2ac84e4f44608fa17be.tar.gz |
sreadahead: Add a patch to set the app to io-idle running status.
This patch sets the sreadahead to io-idle stauts when it is running,
so that sreadahead will not preempt IO with other apps.
Diffstat (limited to 'meta-moblin/packages/sreadahead')
-rw-r--r-- | meta-moblin/packages/sreadahead/sreadahead-0.02/set_to_idle.patch | 39 | ||||
-rw-r--r-- | meta-moblin/packages/sreadahead/sreadahead_0.02.bb | 1 |
2 files changed, 40 insertions, 0 deletions
diff --git a/meta-moblin/packages/sreadahead/sreadahead-0.02/set_to_idle.patch b/meta-moblin/packages/sreadahead/sreadahead-0.02/set_to_idle.patch new file mode 100644 index 0000000000..b48659048a --- /dev/null +++ b/meta-moblin/packages/sreadahead/sreadahead-0.02/set_to_idle.patch | |||
@@ -0,0 +1,39 @@ | |||
1 | diff -Naurp sreadahead-0.02/readahead.c sreadahead-0.02-nice/readahead.c | ||
2 | --- sreadahead-0.02/readahead.c 2008-11-06 00:57:17.000000000 -0500 | ||
3 | +++ sreadahead-0.02-nice/readahead.c 2008-11-06 02:28:29.000000000 -0500 | ||
4 | @@ -26,7 +26,18 @@ | ||
5 | #include <errno.h> | ||
6 | |||
7 | #include "readahead.h" | ||
8 | +#include <sys/syscall.h> | ||
9 | |||
10 | +# if defined(__i386__) | ||
11 | +# define __NR_ioprio_set 289 | ||
12 | +# elif defined(__x86_64__) | ||
13 | +# define __NR_ioprio_set 251 | ||
14 | +# else | ||
15 | +# error "Unsupported arch" | ||
16 | +# endif | ||
17 | + | ||
18 | +#define IOPRIO_WHO_PROCESS 1 | ||
19 | +#define IOPRIO_CLASS_SHIFT 13 | ||
20 | #define MAXR 1024 | ||
21 | static struct readahead files[MAXR]; | ||
22 | static unsigned int total_files = 0; | ||
23 | @@ -68,7 +79,15 @@ void *one_thread(void *ptr) | ||
24 | |||
25 | int main(int argc, char **argv) | ||
26 | { | ||
27 | - FILE *file = fopen("/etc/readahead.packed", "r"); | ||
28 | + int iopriority = 7; /* hard code for idle */ | ||
29 | + int iopriority_class = 3; /* 3 stands for idle */ | ||
30 | + int pid = 0; | ||
31 | + FILE *file; | ||
32 | + | ||
33 | + if (syscall(__NR_ioprio_set, IOPRIO_WHO_PROCESS, pid, iopriority | iopriority_class << IOPRIO_CLASS_SHIFT) == -1) | ||
34 | + perror("Can not set priority to idle class"); | ||
35 | + | ||
36 | + file = fopen("/etc/readahead.packed", "r"); | ||
37 | if (!file) { | ||
38 | perror("Couldnt open /etc/readahead.packed"); | ||
39 | return -errno; | ||
diff --git a/meta-moblin/packages/sreadahead/sreadahead_0.02.bb b/meta-moblin/packages/sreadahead/sreadahead_0.02.bb index 1ca5f16557..b7341010aa 100644 --- a/meta-moblin/packages/sreadahead/sreadahead_0.02.bb +++ b/meta-moblin/packages/sreadahead/sreadahead_0.02.bb | |||
@@ -9,6 +9,7 @@ inherit update-rc.d | |||
9 | SRC_URI = "http://www.moblin.org/sites/all/files/sreadahead-${PV}.tar.gz \ | 9 | SRC_URI = "http://www.moblin.org/sites/all/files/sreadahead-${PV}.tar.gz \ |
10 | file://sreadahead-0.02-make.patch;patch=1 \ | 10 | file://sreadahead-0.02-make.patch;patch=1 \ |
11 | file://readahead_c.patch;patch=1 \ | 11 | file://readahead_c.patch;patch=1 \ |
12 | file://set_to_idle.patch;patch=1 \ | ||
12 | file://sreadahead-generate.sh \ | 13 | file://sreadahead-generate.sh \ |
13 | file://sreadahead.sh" | 14 | file://sreadahead.sh" |
14 | 15 | ||