diff options
author | Michal Schmidt <mschmidt@redhat.com> | 2011-06-10 14:37:21 +0200 |
---|---|---|
committer | Kay Sievers <kay.sievers@vrfy.org> | 2011-06-10 14:57:12 +0200 |
commit | 597b99b09a007dfa8ddfce31c480765b0c7baa6a (patch) | |
tree | 426014cb58ea155a3c53c7523688c38fea53eb0a | |
parent | dc725264f34f3a81eb47b7472f4484f849e0461d (diff) |
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
-rw-r--r-- | src/readahead-common.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/readahead-common.c b/src/readahead-common.c index 8a75b2e135..f0d57b4c6e 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) { |