From d9e9f0d71d0af6ce444fd89cb3c4b40c9fc84ebb Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Sun, 13 Mar 2011 22:28:28 +1100 Subject: [PATCH] No need to keep usable_ram as a rzip_control variable. --- lrzip_private.h | 1 - main.c | 15 ++++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lrzip_private.h b/lrzip_private.h index cf223d5..eec9ff7 100644 --- a/lrzip_private.h +++ b/lrzip_private.h @@ -174,7 +174,6 @@ struct rzip_control { i64 window; unsigned long flags; i64 ramsize; - i64 usable_ram; i64 max_chunk; i64 max_mmap; int threads; diff --git a/main.c b/main.c index 8d85c6e..92ba8f2 100644 --- a/main.c +++ b/main.c @@ -634,12 +634,6 @@ int main(int argc, char *argv[]) } else if (ZPAQ_COMPRESS) control.overhead = 112 * 1024 * 1024; - /* Decrease usable ram size on 32 bits due to kernel/userspace split */ - if (BITS32) - control.usable_ram = MAX(control.ramsize - 900000000ll, 900000000ll); - else - control.usable_ram = control.ramsize; - /* Set the main nice value to half that of the backend threads since * the rzip stage is usually the rate limiting step */ if (control.nice_val > 0 && !NO_COMPRESS) { @@ -710,7 +704,14 @@ int main(int argc, char *argv[]) else control.maxram = control.ramsize / 3; if (BITS32) { - control.maxram = MIN(control.maxram, control.usable_ram); + i64 usable_ram; + + /* Decrease usable ram size on 32 bits due to kernel / + * userspace split. Cannot allocate larger than a 2 + * gigabyte chunk due to 32 bit signed long being + * used in alloc */ + usable_ram = MAX(control.ramsize - 900000000ll, 900000000ll); + control.maxram = MIN(control.maxram, usable_ram); control.maxram = MIN(control.maxram, two_gig); } round_to_page(&control.maxram);