From 40c50852f57308abb0f934cad8ebf30d61141917 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Wed, 27 Oct 2010 22:58:16 +0000 Subject: [PATCH] - scheduler: fix logic that deals with jobs that need > 2GB RAM. My change of 1 Oct ([22440]) required that such jobs be processed with 64-bit apps, on the assumption that 32-bit apps have a 2 GB user address space limit. However, it turns out this limit applies only to Windows (kernel and user mode share the 4GB address space; each gets half). On Linux, the split is 3GB user / 1 GB kernel. On Mac OS X, user mode and kernel mode have separate address spaces, each of them 4 GB. svn path=/trunk/boinc/; revision=22599 --- checkin_notes | 35 +++++++++++++++++++++++++++++++++++ client/app.cpp | 1 + client/hostinfo_unix.cpp | 8 +++++--- client/hostinfo_win.cpp | 6 ++++-- lib/coproc.cpp | 2 +- lib/str_util.h | 4 ---- lib/util.h | 3 +++ sched/sched_customize.cpp | 1 + sched/sched_score.cpp | 2 +- sched/sched_version.cpp | 20 +++++++++++++++++++- 10 files changed, 70 insertions(+), 12 deletions(-) diff --git a/checkin_notes b/checkin_notes index 9aa29d9fee..261f66dd40 100644 --- a/checkin_notes +++ b/checkin_notes @@ -7571,3 +7571,38 @@ David 22 Oct 2010 client/ work_fetch.cpp + +David 26 Oct 2010 + - client: linux compile fix + - client: small fix for GPU scheduling + (use anticipated debt instead of STD) + + client/ + app_start.cpp + cpu_sched.cpp + sim.cpp + client_types.h + +David 27 Oct 2010 + - scheduler: fix logic that deals with jobs that need > 2GB RAM. + My change of 1 Oct ([22440]) required that such jobs + be processed with 64-bit apps, + on the assumption that 32-bit apps have a 2 GB user address space limit. + However, it turns out this limit applies only to Windows + (kernel and user mode share the 4GB address space; each gets half). + On Linux, the split is 3GB user / 1 GB kernel. + On Mac OS X, user mode and kernel mode have separate address spaces, + each of them 4 GB. + + client/ + app.cpp + hostinfo_unix.cpp + hostinfo_win.cpp + lib/ + coproc.cpp + str_util.h + util.h + sched/ + sched_customize.cpp + sched_score.cpp + sched_version.cpp diff --git a/client/app.cpp b/client/app.cpp index 1c65cf99a4..0eda1f6b24 100644 --- a/client/app.cpp +++ b/client/app.cpp @@ -60,6 +60,7 @@ #include "shmem.h" #include "str_util.h" #include "str_replace.h" +#include "util.h" #include "client_state.h" #include "client_msgs.h" diff --git a/client/hostinfo_unix.cpp b/client/hostinfo_unix.cpp index f103d60b5d..19e7c5fc50 100644 --- a/client/hostinfo_unix.cpp +++ b/client/hostinfo_unix.cpp @@ -100,14 +100,16 @@ #include "win/opt_x86.h" #endif -#include "client_types.h" -#include "filesys.h" #include "error_numbers.h" +#include "filesys.h" #include "str_util.h" #include "str_replace.h" +#include "util.h" + #include "client_state.h" -#include "hostinfo_network.h" +#include "client_types.h" #include "client_msgs.h" +#include "hostinfo_network.h" using std::string; diff --git a/client/hostinfo_win.cpp b/client/hostinfo_win.cpp index 0babc05973..94352bb38e 100644 --- a/client/hostinfo_win.cpp +++ b/client/hostinfo_win.cpp @@ -27,12 +27,14 @@ #include #endif -#include "client_types.h" +#include "error_numbers.h" #include "filesys.h" #include "str_util.h" #include "str_replace.h" +#include "util.h" + #include "client_msgs.h" -#include "error_numbers.h" +#include "client_types.h" #include "hostinfo_network.h" #include "hostinfo.h" #include "idlemon.h" diff --git a/lib/coproc.cpp b/lib/coproc.cpp index 4a310517c7..01500b3a64 100644 --- a/lib/coproc.cpp +++ b/lib/coproc.cpp @@ -36,7 +36,7 @@ #include "error_numbers.h" #include "filesys.h" #include "parse.h" -#include "str_util.h" +#include "util.h" #include "coproc.h" diff --git a/lib/str_util.h b/lib/str_util.h index 027f484a73..e41e0f512c 100644 --- a/lib/str_util.h +++ b/lib/str_util.h @@ -25,10 +25,6 @@ #include #include -#define KILO (1024.0) -#define MEGA (1048576.0) -#define GIGA (1024.*1048576.0) - extern int ndays_to_string(double x, int smallest_timescale, char *buf); extern void nbytes_to_string(double nbytes, double total_bytes, char* str, int len); extern int parse_command_line(char*, char**); diff --git a/lib/util.h b/lib/util.h index 32677a031e..31fd4cb301 100644 --- a/lib/util.h +++ b/lib/util.h @@ -35,6 +35,9 @@ extern void push_unique(std::string, std::vector&); // NOTE: use #include to get max,min #define SECONDS_PER_DAY 86400 +#define KILO (1024.0) +#define MEGA (1048576.0) +#define GIGA (1024.*1048576.0) static inline double drand() { return (double)rand()/(double)RAND_MAX; diff --git a/sched/sched_customize.cpp b/sched/sched_customize.cpp index c5f029577c..bae6e83d90 100644 --- a/sched/sched_customize.cpp +++ b/sched/sched_customize.cpp @@ -50,6 +50,7 @@ // In either case, put your version under source-code control, e.g. SVN #include "str_util.h" +#include "util.h" #include "sched_config.h" #include "sched_main.h" diff --git a/sched/sched_score.cpp b/sched/sched_score.cpp index 3951e758b2..e7903c61ef 100644 --- a/sched/sched_score.cpp +++ b/sched/sched_score.cpp @@ -19,7 +19,7 @@ #include "boinc_db.h" #include "error_numbers.h" -#include "str_util.h" +#include "util.h" #include "sched_main.h" #include "sched_config.h" diff --git a/sched/sched_version.cpp b/sched/sched_version.cpp index 58d79fd145..c472d78cc0 100644 --- a/sched/sched_version.cpp +++ b/sched/sched_version.cpp @@ -360,6 +360,24 @@ static void app_version_desc(BEST_APP_VERSION& bav, char* buf) { } } +// different OSs have different max user address space for 32 bit apps +// +static double max_32b_address_space() { + if (strstr(g_request->platform.name, "windows")) { + return 2*GIGA; + } else if (strstr(g_request->platform.name, "linux")) { + return 3*GIGA; + } else if (strstr(g_request->platform.name, "darwin")) { + return 4*GIGA; + } else if (strstr(g_request->platform.name, "solaris")) { + return 4*GIGA; + } else if (strstr(g_request->platform.name, "anonymous")) { + // problem case. assume windows + return 2*GIGA; + } + return 2*GIGA; +} + // return BEST_APP_VERSION for the given job and host, or NULL if none // // check_req: check whether we still need work for the resource @@ -378,7 +396,7 @@ BEST_APP_VERSION* get_app_version( int j; BEST_APP_VERSION* bavp; char message[256], buf[256]; - bool job_needs_64b = (wu.rsc_memory_bound > 2.1e9); + bool job_needs_64b = (wu.rsc_memory_bound > max_32b_address_space()); if (config.debug_version_select) { if (job_needs_64b) {