Michal Schmidt 62bfbd
From 597b99b09a007dfa8ddfce31c480765b0c7baa6a Mon Sep 17 00:00:00 2001
Michal Schmidt 62bfbd
From: Michal Schmidt <mschmidt@redhat.com>
Michal Schmidt 62bfbd
Date: Fri, 10 Jun 2011 14:37:21 +0200
Michal Schmidt 62bfbd
Subject: [PATCH 6/6] readahead-common: fix total memory size detection
Michal Schmidt 62bfbd
Michal Schmidt 62bfbd
sysinfo returns the total memory size in multiples of mem_unit bytes.
Michal Schmidt 62bfbd
As long as the size in bytes fits into unsigned long, the kernel uses
Michal Schmidt 62bfbd
mem_unit = 1, but this is not true on i386 with more than 4 GB RAM.
Michal Schmidt 62bfbd
Michal Schmidt 62bfbd
https://bugzilla.redhat.com/show_bug.cgi?id=712341
Michal Schmidt 62bfbd
---
Michal Schmidt 62bfbd
 src/readahead-common.c |    5 ++---
Michal Schmidt 62bfbd
 1 files changed, 2 insertions(+), 3 deletions(-)
Michal Schmidt 62bfbd
Michal Schmidt 62bfbd
diff --git a/src/readahead-common.c b/src/readahead-common.c
Michal Schmidt 62bfbd
index 8a75b2e..f0d57b4 100644
Michal Schmidt 62bfbd
--- a/src/readahead-common.c
Michal Schmidt 62bfbd
+++ b/src/readahead-common.c
Michal Schmidt 62bfbd
@@ -154,9 +154,8 @@ bool enough_ram(void) {
Michal Schmidt 62bfbd
 
Michal Schmidt 62bfbd
         assert_se(sysinfo(&si) >= 0);
Michal Schmidt 62bfbd
 
Michal Schmidt 62bfbd
-        return si.totalram > 127 * 1024*1024; /* Enable readahead only
Michal Schmidt 62bfbd
-                                               * with at least 128MB
Michal Schmidt 62bfbd
-                                               * memory */
Michal Schmidt 62bfbd
+        /* Enable readahead only with at least 128MB memory */
Michal Schmidt 62bfbd
+        return si.totalram > 127 * 1024*1024 / si.mem_unit;
Michal Schmidt 62bfbd
 }
Michal Schmidt 62bfbd
 
Michal Schmidt 62bfbd
 int open_inotify(void) {
Michal Schmidt 62bfbd
-- 
Michal Schmidt 62bfbd
1.7.4.4
Michal Schmidt 62bfbd