- VBOX: Give the VM process a short priority boost when responding

to a quit request.  On older XP machines it might speed up the memory
        dump to disk.
    - client: Increase the quit request timeout from 10 seconds to 60 seconds for
        machines running VMs and slow disk drives.  It should give the VM enough
        time to gracefully shutdown and not give boinc reason to kill the wrapper.

    client/
        app.h
    samples/vboxwrapper/
        vbox.cpp, .h
        vboxwrapper.cpp

svn path=/trunk/boinc/; revision=25433
This commit is contained in:
Rom Walton 2012-03-16 01:04:43 +00:00
parent 73474ac408
commit 25142dda02
6 changed files with 36 additions and 18 deletions

View File

@ -2701,3 +2701,17 @@ David 15 Mar 2012
sched_config.cpp,h
feeder.cpp
hr_info.cpp
Rom 15 Mar 2012
- VBOX: Give the VM process a short priority boost when responding
to a quit request. On older XP machines it might speed up the memory
dump to disk.
- client: Increase the quit request timeout from 10 seconds to 60 seconds for
machines running VMs and slow disk drives. It should give the VM enough
time to gracefully shutdown and not give boinc reason to kill the wrapper.
client/
app.h
samples/vboxwrapper/
vbox.cpp, .h
vboxwrapper.cpp

View File

@ -32,8 +32,8 @@
// if we send app <abort> request, wait this long before killing it.
// This gives it time to download symbol files (which can be several MB)
// and write stack trace to stderr
#define QUIT_TIMEOUT 10
// Same, for <quit>. Shorter because no stack trace is generated
#define QUIT_TIMEOUT 60
// Same, for <quit>.
// values for preempt_type
//

View File

@ -1307,7 +1307,7 @@ int VBOX_VM::write_floppy(std::string& data) {
return 1;
}
void VBOX_VM::reset_vm_process_priority() {
void VBOX_VM::lower_vm_process_priority() {
#ifndef _WIN32
if (vm_pid) {
setpriority(PRIO_PROCESS, vm_pid, PROCESS_IDLE_PRIORITY);
@ -1319,6 +1319,18 @@ void VBOX_VM::reset_vm_process_priority() {
#endif
}
void VBOX_VM::reset_vm_process_priority() {
#ifndef _WIN32
if (vm_pid) {
setpriority(PRIO_PROCESS, vm_pid, PROCESS_MEDIUM_PRIORITY);
}
#else
if (vm_pid_handle) {
SetPriorityClass(vm_pid_handle, NORMAL_PRIORITY_CLASS);
}
#endif
}
// If there are errors we can recover from, process them here.
//
int VBOX_VM::vbm_popen(string& arguments, string& output, const char* item, bool log_error, bool retry_failures) {

View File

@ -126,6 +126,7 @@ struct VBOX_VM {
int read_floppy(std::string& data);
int write_floppy(std::string& data);
void lower_vm_process_priority();
void reset_vm_process_priority();
int vbm_popen(

View File

@ -540,6 +540,7 @@ int main(int argc, char** argv) {
vm.poll();
if (boinc_status.no_heartbeat || boinc_status.quit_request) {
vm.reset_vm_process_priority();
vm.stop();
write_checkpoint(checkpoint_cpu_time, vm);
boinc_temporary_exit(0);
@ -589,20 +590,10 @@ int main(int argc, char** argv) {
}
if (boinc_status.suspended) {
if (!vm.suspended) {
fprintf(
stderr,
"%s Suspending VM.\n",
vboxwrapper_msg_prefix(buf, sizeof(buf))
);
vm.pause();
}
} else {
if (vm.suspended) {
fprintf(
stderr,
"%s Resuming VM.\n",
vboxwrapper_msg_prefix(buf, sizeof(buf))
);
vm.resume();
}
@ -611,7 +602,7 @@ int main(int argc, char** argv) {
if (!vm_pid) {
vm.get_vm_process_id(vm_pid);
if (vm_pid) {
vm.reset_vm_process_priority();
vm.lower_vm_process_priority();
report_vm_pid = true;
}
}

View File

@ -81,13 +81,13 @@
<Tool
Name="VCLinkerTool"
AdditionalDependencies="libcmt.lib libcpmt.lib kernel32.lib user32.lib gdi32.lib ole32.lib wsock32.lib"
OutputFile=".\Build\$(PlatformName)\$(ConfigurationName)\vboxwrapper_25404_windows_intelx86.exe"
OutputFile=".\Build\$(PlatformName)\$(ConfigurationName)\vboxwrapper_25425_windows_intelx86.exe"
LinkIncremental="0"
SuppressStartupBanner="true"
IgnoreAllDefaultLibraries="true"
DelayLoadDLLs=""
GenerateDebugInformation="true"
ProgramDatabaseFile=".\Build\$(PlatformName)\$(ConfigurationName)\vboxwrapper_25404_windows_intelx86.pdb"
ProgramDatabaseFile=".\Build\$(PlatformName)\$(ConfigurationName)\vboxwrapper_25425_windows_intelx86.pdb"
SubSystem="2"
TargetMachine="1"
/>
@ -182,13 +182,13 @@
<Tool
Name="VCLinkerTool"
AdditionalDependencies="libcmt.lib libcpmt.lib kernel32.lib user32.lib gdi32.lib ole32.lib wsock32.lib"
OutputFile=".\Build\$(PlatformName)\$(ConfigurationName)\vboxwrapper_25404_windows_x86_64.exe"
OutputFile=".\Build\$(PlatformName)\$(ConfigurationName)\vboxwrapper_25425_windows_x86_64.exe"
LinkIncremental="0"
SuppressStartupBanner="true"
IgnoreAllDefaultLibraries="true"
DelayLoadDLLs=""
GenerateDebugInformation="true"
ProgramDatabaseFile=".\Build\$(PlatformName)\$(ConfigurationName)\vboxwrapper_25404_windows_x86_64.pdb"
ProgramDatabaseFile=".\Build\$(PlatformName)\$(ConfigurationName)\vboxwrapper_25425_windows_x86_64.pdb"
SubSystem="2"
TargetMachine="17"
/>