diff options
-rw-r--r-- | meta/recipes-core/systemd/systemd/0002-readahead-chunk-on-spinning-media.patch | 142 | ||||
-rw-r--r-- | meta/recipes-core/systemd/systemd/0003-readahead-cleanups.patch | 86 | ||||
-rw-r--r-- | meta/recipes-core/systemd/systemd/0013-systemd-sysctl-Handle-missing-etc-sysctl.conf-proper.patch | 33 | ||||
-rw-r--r-- | meta/recipes-core/systemd/systemd_199.bb (renamed from meta/recipes-core/systemd/systemd_198.bb) | 11 |
4 files changed, 268 insertions, 4 deletions
diff --git a/meta/recipes-core/systemd/systemd/0002-readahead-chunk-on-spinning-media.patch b/meta/recipes-core/systemd/systemd/0002-readahead-chunk-on-spinning-media.patch new file mode 100644 index 0000000000..d57a01c916 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0002-readahead-chunk-on-spinning-media.patch | |||
@@ -0,0 +1,142 @@ | |||
1 | Upstream-Status: Backport | ||
2 | |||
3 | -Khem 2013/03/28 | ||
4 | |||
5 | From 94243ef299425d6c7089a7a05c48c9bb8f6cf3da Mon Sep 17 00:00:00 2001 | ||
6 | From: Auke Kok <auke-jan.h.kok@intel.com> | ||
7 | Date: Fri, 22 Mar 2013 15:09:45 -0700 | ||
8 | Subject: [PATCH 02/17] readahead: chunk on spinning media | ||
9 | |||
10 | Readahead has all sorts of bad side effects depending on your | ||
11 | storage media. On rotating disks, it may be degrading startup | ||
12 | performance if enough requests are queued spanning linearly | ||
13 | over all blocks early at boot, and mount, blkid and friends | ||
14 | want to insert reads to the start of these block devices after. | ||
15 | |||
16 | The end result is that on spinning disks with ext3/4 that udev | ||
17 | and mounts take a very long time, and nothing really happens until | ||
18 | readahead is completely finished. | ||
19 | |||
20 | This has the net effect that the CPU is almost entirely idle | ||
21 | for the entire period that readahead is working. We could have | ||
22 | finished starting up quite a lot of services in this time if | ||
23 | we were smarter at how we do readahead. | ||
24 | |||
25 | This patch sorts all requests into 2 second "chunks" and sub-sorts | ||
26 | each chunk by block. This adds a single cross-drive seek per "chunk" | ||
27 | but has the benefit that we will have a lot of the blocks we need | ||
28 | early on in the boot sequence loaded into memory faster. | ||
29 | |||
30 | For a comparison of how before/after bootcharts look (ext4 on a | ||
31 | mobile 5400rpm 250GB drive) please look at: | ||
32 | |||
33 | http://foo-projects.org/~sofar/blocked-tests/ | ||
34 | |||
35 | There are bootcharts in the "before" and "after" folders where you | ||
36 | should be able to see that many low-level services finish 5-7 | ||
37 | seconds earlier with the patch applied (after). | ||
38 | --- | ||
39 | Makefile.am | 2 +- | ||
40 | src/readahead/readahead-collect.c | 28 +++++++++++++++++++++++++--- | ||
41 | 2 files changed, 26 insertions(+), 4 deletions(-) | ||
42 | |||
43 | diff --git a/Makefile.am b/Makefile.am | ||
44 | index 37c1cc2..5861976 100644 | ||
45 | --- a/Makefile.am | ||
46 | +++ b/Makefile.am | ||
47 | @@ -2956,7 +2956,7 @@ systemd_readahead_SOURCES = \ | ||
48 | systemd_readahead_LDADD = \ | ||
49 | libsystemd-shared.la \ | ||
50 | libsystemd-daemon.la \ | ||
51 | - libudev.la | ||
52 | + libudev.la -lm | ||
53 | |||
54 | dist_doc_DATA += \ | ||
55 | src/readahead/sd-readahead.c \ | ||
56 | diff --git a/src/readahead/readahead-collect.c b/src/readahead/readahead-collect.c | ||
57 | index 5d07f47..5d22949 100644 | ||
58 | --- a/src/readahead/readahead-collect.c | ||
59 | +++ b/src/readahead/readahead-collect.c | ||
60 | @@ -42,6 +42,7 @@ | ||
61 | #include <sys/vfs.h> | ||
62 | #include <getopt.h> | ||
63 | #include <sys/inotify.h> | ||
64 | +#include <math.h> | ||
65 | |||
66 | #ifdef HAVE_FANOTIFY_INIT | ||
67 | #include <sys/fanotify.h> | ||
68 | @@ -67,6 +68,7 @@ | ||
69 | */ | ||
70 | |||
71 | static ReadaheadShared *shared = NULL; | ||
72 | +static struct timespec starttime; | ||
73 | |||
74 | /* Avoid collisions with the NULL pointer */ | ||
75 | #define SECTOR_TO_PTR(s) ULONG_TO_PTR((s)+1) | ||
76 | @@ -205,6 +207,7 @@ static unsigned long fd_first_block(int fd) { | ||
77 | struct item { | ||
78 | const char *path; | ||
79 | unsigned long block; | ||
80 | + unsigned long bin; | ||
81 | }; | ||
82 | |||
83 | static int qsort_compare(const void *a, const void *b) { | ||
84 | @@ -213,6 +216,13 @@ static int qsort_compare(const void *a, const void *b) { | ||
85 | i = a; | ||
86 | j = b; | ||
87 | |||
88 | + /* sort by bin first */ | ||
89 | + if (i->bin < j->bin) | ||
90 | + return -1; | ||
91 | + if (i->bin > j->bin) | ||
92 | + return 1; | ||
93 | + | ||
94 | + /* then sort by sector */ | ||
95 | if (i->block < j->block) | ||
96 | return -1; | ||
97 | if (i->block > j->block) | ||
98 | @@ -250,6 +260,8 @@ static int collect(const char *root) { | ||
99 | goto finish; | ||
100 | } | ||
101 | |||
102 | + clock_gettime(CLOCK_MONOTONIC, &starttime); | ||
103 | + | ||
104 | /* If there's no pack file yet we lower the kernel readahead | ||
105 | * so that mincore() is accurate. If there is a pack file | ||
106 | * already we assume it is accurate enough so that kernel | ||
107 | @@ -447,10 +459,21 @@ static int collect(const char *root) { | ||
108 | free(p); | ||
109 | else { | ||
110 | unsigned long ul; | ||
111 | + struct timespec ts; | ||
112 | + struct item *entry; | ||
113 | + | ||
114 | + entry = new0(struct item, 1); | ||
115 | |||
116 | ul = fd_first_block(m->fd); | ||
117 | |||
118 | - if ((k = hashmap_put(files, p, SECTOR_TO_PTR(ul))) < 0) { | ||
119 | + clock_gettime(CLOCK_MONOTONIC, &ts); | ||
120 | + | ||
121 | + entry->block = ul; | ||
122 | + entry->path = strdup(p); | ||
123 | + entry->bin = round((ts.tv_sec - starttime.tv_sec + | ||
124 | + ((ts.tv_nsec - starttime.tv_nsec) / 1000000000.0)) / 2.0); | ||
125 | + | ||
126 | + if ((k = hashmap_put(files, p, entry)) < 0) { | ||
127 | log_warning("set_put() failed: %s", strerror(-k)); | ||
128 | free(p); | ||
129 | } | ||
130 | @@ -518,8 +541,7 @@ done: | ||
131 | |||
132 | j = ordered; | ||
133 | HASHMAP_FOREACH_KEY(q, p, files, i) { | ||
134 | - j->path = p; | ||
135 | - j->block = PTR_TO_SECTOR(q); | ||
136 | + memcpy(j, q, sizeof(struct item)); | ||
137 | j++; | ||
138 | } | ||
139 | |||
140 | -- | ||
141 | 1.7.9.5 | ||
142 | |||
diff --git a/meta/recipes-core/systemd/systemd/0003-readahead-cleanups.patch b/meta/recipes-core/systemd/systemd/0003-readahead-cleanups.patch new file mode 100644 index 0000000000..e0b68df607 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0003-readahead-cleanups.patch | |||
@@ -0,0 +1,86 @@ | |||
1 | Upstream-Status: Backport | ||
2 | |||
3 | -Khem 2013/03/28 | ||
4 | |||
5 | From b0640287f784a320661f7206c9ade07b99003fd5 Mon Sep 17 00:00:00 2001 | ||
6 | From: Auke Kok <auke-jan.h.kok@intel.com> | ||
7 | Date: Tue, 26 Mar 2013 11:13:47 -0700 | ||
8 | Subject: [PATCH 03/17] readahead: cleanups | ||
9 | |||
10 | - check for OOM | ||
11 | - no need to use floats and round() | ||
12 | --- | ||
13 | Makefile.am | 2 +- | ||
14 | src/readahead/readahead-collect.c | 20 ++++++++++++++------ | ||
15 | 2 files changed, 15 insertions(+), 7 deletions(-) | ||
16 | |||
17 | diff --git a/Makefile.am b/Makefile.am | ||
18 | index 5861976..37c1cc2 100644 | ||
19 | --- a/Makefile.am | ||
20 | +++ b/Makefile.am | ||
21 | @@ -2956,7 +2956,7 @@ systemd_readahead_SOURCES = \ | ||
22 | systemd_readahead_LDADD = \ | ||
23 | libsystemd-shared.la \ | ||
24 | libsystemd-daemon.la \ | ||
25 | - libudev.la -lm | ||
26 | + libudev.la | ||
27 | |||
28 | dist_doc_DATA += \ | ||
29 | src/readahead/sd-readahead.c \ | ||
30 | diff --git a/src/readahead/readahead-collect.c b/src/readahead/readahead-collect.c | ||
31 | index 5d22949..e2fd8df 100644 | ||
32 | --- a/src/readahead/readahead-collect.c | ||
33 | +++ b/src/readahead/readahead-collect.c | ||
34 | @@ -68,7 +68,7 @@ | ||
35 | */ | ||
36 | |||
37 | static ReadaheadShared *shared = NULL; | ||
38 | -static struct timespec starttime; | ||
39 | +static usec_t starttime; | ||
40 | |||
41 | /* Avoid collisions with the NULL pointer */ | ||
42 | #define SECTOR_TO_PTR(s) ULONG_TO_PTR((s)+1) | ||
43 | @@ -260,7 +260,7 @@ static int collect(const char *root) { | ||
44 | goto finish; | ||
45 | } | ||
46 | |||
47 | - clock_gettime(CLOCK_MONOTONIC, &starttime); | ||
48 | + starttime = now(CLOCK_MONOTONIC); | ||
49 | |||
50 | /* If there's no pack file yet we lower the kernel readahead | ||
51 | * so that mincore() is accurate. If there is a pack file | ||
52 | @@ -459,19 +459,27 @@ static int collect(const char *root) { | ||
53 | free(p); | ||
54 | else { | ||
55 | unsigned long ul; | ||
56 | - struct timespec ts; | ||
57 | + usec_t entrytime; | ||
58 | struct item *entry; | ||
59 | |||
60 | entry = new0(struct item, 1); | ||
61 | + if (!entry) { | ||
62 | + r = log_oom(); | ||
63 | + goto finish; | ||
64 | + } | ||
65 | |||
66 | ul = fd_first_block(m->fd); | ||
67 | |||
68 | - clock_gettime(CLOCK_MONOTONIC, &ts); | ||
69 | + entrytime = now(CLOCK_MONOTONIC); | ||
70 | |||
71 | entry->block = ul; | ||
72 | entry->path = strdup(p); | ||
73 | - entry->bin = round((ts.tv_sec - starttime.tv_sec + | ||
74 | - ((ts.tv_nsec - starttime.tv_nsec) / 1000000000.0)) / 2.0); | ||
75 | + if (!entry->path) { | ||
76 | + free(entry); | ||
77 | + r = log_oom(); | ||
78 | + goto finish; | ||
79 | + } | ||
80 | + entry->bin = (entrytime - starttime) / 2000000; | ||
81 | |||
82 | if ((k = hashmap_put(files, p, entry)) < 0) { | ||
83 | log_warning("set_put() failed: %s", strerror(-k)); | ||
84 | -- | ||
85 | 1.7.9.5 | ||
86 | |||
diff --git a/meta/recipes-core/systemd/systemd/0013-systemd-sysctl-Handle-missing-etc-sysctl.conf-proper.patch b/meta/recipes-core/systemd/systemd/0013-systemd-sysctl-Handle-missing-etc-sysctl.conf-proper.patch new file mode 100644 index 0000000000..f2c8e0290f --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0013-systemd-sysctl-Handle-missing-etc-sysctl.conf-proper.patch | |||
@@ -0,0 +1,33 @@ | |||
1 | Upstream-Status: Backport | ||
2 | |||
3 | -Khem 2013/03/28 | ||
4 | |||
5 | From 6f6fad96addf6b00b55c98cc0d0d8026b0c1e7ca Mon Sep 17 00:00:00 2001 | ||
6 | From: Eelco Dolstra <eelco.dolstra@logicblox.com> | ||
7 | Date: Wed, 27 Mar 2013 13:41:59 +0100 | ||
8 | Subject: [PATCH 13/17] systemd-sysctl: Handle missing /etc/sysctl.conf | ||
9 | properly | ||
10 | |||
11 | Since fabe5c0e5fce730aa66e10a9c4f9fdd443d7aeda, systemd-sysctl returns | ||
12 | a non-zero exit code if /etc/sysctl.conf does not exist, due to a | ||
13 | broken ENOENT check. | ||
14 | --- | ||
15 | src/sysctl/sysctl.c | 2 +- | ||
16 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
17 | |||
18 | diff --git a/src/sysctl/sysctl.c b/src/sysctl/sysctl.c | ||
19 | index 2d43660..79f3f77 100644 | ||
20 | --- a/src/sysctl/sysctl.c | ||
21 | +++ b/src/sysctl/sysctl.c | ||
22 | @@ -125,7 +125,7 @@ static int parse_file(Hashmap *sysctl_options, const char *path, bool ignore_eno | ||
23 | |||
24 | r = search_and_fopen_nulstr(path, "re", conf_file_dirs, &f); | ||
25 | if (r < 0) { | ||
26 | - if (ignore_enoent && errno == -ENOENT) | ||
27 | + if (ignore_enoent && r == -ENOENT) | ||
28 | return 0; | ||
29 | |||
30 | log_error("Failed to open file '%s', ignoring: %s", path, strerror(-r)); | ||
31 | -- | ||
32 | 1.7.9.5 | ||
33 | |||
diff --git a/meta/recipes-core/systemd/systemd_198.bb b/meta/recipes-core/systemd/systemd_199.bb index 6a8db512ca..74b14afeaf 100644 --- a/meta/recipes-core/systemd/systemd_198.bb +++ b/meta/recipes-core/systemd/systemd_199.bb | |||
@@ -23,10 +23,13 @@ SRC_URI = "http://www.freedesktop.org/software/systemd/systemd-${PV}.tar.xz \ | |||
23 | file://var-run.conf \ | 23 | file://var-run.conf \ |
24 | ${UCLIBCPATCHES} \ | 24 | ${UCLIBCPATCHES} \ |
25 | file://00-create-volatile.conf \ | 25 | file://00-create-volatile.conf \ |
26 | file://0002-readahead-chunk-on-spinning-media.patch \ | ||
27 | file://0003-readahead-cleanups.patch \ | ||
28 | file://0013-systemd-sysctl-Handle-missing-etc-sysctl.conf-proper.patch \ | ||
26 | file://init \ | 29 | file://init \ |
27 | " | 30 | " |
28 | SRC_URI[md5sum] = "26a75e2a310f8c1c1ea9ec26ddb171c5" | 31 | SRC_URI[md5sum] = "4bb13f84ce211e93f0141774a90a2322" |
29 | SRC_URI[sha256sum] = "444492355e5ff0ad99e0691ecaff1081ee8d45901580f47ba8b74e56107c71bf" | 32 | SRC_URI[sha256sum] = "8c4462a04f3ecf7f083782e5e0687913b1d33c6444bf20fa2f31df9222965fed" |
30 | 33 | ||
31 | UCLIBCPATCHES = "" | 34 | UCLIBCPATCHES = "" |
32 | UCLIBCPATCHES_libc-uclibc = "file://systemd-pam-configure-check-uclibc.patch \ | 35 | UCLIBCPATCHES_libc-uclibc = "file://systemd-pam-configure-check-uclibc.patch \ |
@@ -114,7 +117,7 @@ PACKAGES_DYNAMIC += "^lib(udev|gudev|systemd).*" | |||
114 | PACKAGES =+ "${PN}-gui ${PN}-vconsole-setup ${PN}-initramfs ${PN}-analyze" | 117 | PACKAGES =+ "${PN}-gui ${PN}-vconsole-setup ${PN}-initramfs ${PN}-analyze" |
115 | 118 | ||
116 | USERADD_PACKAGES = "${PN}" | 119 | USERADD_PACKAGES = "${PN}" |
117 | GROUPADD_PARAM_${PN} = "-r lock" | 120 | GROUPADD_PARAM_${PN} = "-r lock; -r systemd-journal" |
118 | 121 | ||
119 | FILES_${PN}-analyze = "${base_bindir}/systemd-analyze" | 122 | FILES_${PN}-analyze = "${base_bindir}/systemd-analyze" |
120 | 123 | ||
@@ -224,7 +227,7 @@ FILES_udev += "${base_sbindir}/udevd \ | |||
224 | FILES_udev-consolekit += "/lib/ConsoleKit" | 227 | FILES_udev-consolekit += "/lib/ConsoleKit" |
225 | RDEPENDS_udev-consolekit += "${@base_contains('DISTRO_FEATURES', 'x11', 'consolekit', '', d)}" | 228 | RDEPENDS_udev-consolekit += "${@base_contains('DISTRO_FEATURES', 'x11', 'consolekit', '', d)}" |
226 | 229 | ||
227 | FILES_udev-utils = "${bindir}/udevadm" | 230 | FILES_udev-utils = "${base_bindir}/udevadm ${datadir}/bash-completion/completions/udevadm" |
228 | 231 | ||
229 | FILES_udev-hwdb = "${base_libdir}/udev/hwdb.d" | 232 | FILES_udev-hwdb = "${base_libdir}/udev/hwdb.d" |
230 | 233 | ||