From: Michal Schmidt Date: Fri, 10 Jun 2011 12:37:21 +0000 (+0200) Subject: readahead-common: fix total memory size detection X-Git-Tag: v29~14 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=597b99b09a007dfa8ddfce31c480765b0c7baa6a;p=systemd readahead-common: fix total memory size detection sysinfo returns the total memory size in multiples of mem_unit bytes. As long as the size in bytes fits into unsigned long, the kernel uses mem_unit = 1, but this is not true on i386 with more than 4 GB RAM. https://bugzilla.redhat.com/show_bug.cgi?id=712341 --- diff --git a/src/readahead-common.c b/src/readahead-common.c index 8a75b2e1..f0d57b4c 100644 --- a/src/readahead-common.c +++ b/src/readahead-common.c @@ -154,9 +154,8 @@ bool enough_ram(void) { assert_se(sysinfo(&si) >= 0); - return si.totalram > 127 * 1024*1024; /* Enable readahead only - * with at least 128MB - * memory */ + /* Enable readahead only with at least 128MB memory */ + return si.totalram > 127 * 1024*1024 / si.mem_unit; } int open_inotify(void) {