From 901f1a7ab1b68005d1cc3b54939f902d61739feb Mon Sep 17 00:00:00 2001 From: XMRig Date: Wed, 4 Dec 2019 08:50:54 +0700 Subject: [PATCH] Option "yield" enabled by default and added command line option --cpu-no-yield. --- README.md | 1 + doc/CPU.md | 5 ++++- src/backend/cpu/CpuConfig.h | 2 +- src/base/kernel/interfaces/IConfig.h | 1 + src/config.json | 2 +- src/core/config/ConfigTransform.cpp | 4 +++- src/core/config/Config_default.h | 2 ++ src/core/config/Config_platform.h | 1 + src/core/config/usage.h | 1 + 9 files changed, 15 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 6b7ce909..7563ff2d 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,7 @@ CPU backend: --cpu-priority set process priority (0 idle, 2 normal to 5 highest) --cpu-max-threads-hint=N maximum CPU threads count (in percentage) hint for autoconfig --cpu-memory-pool=N number of 2 MB pages for persistent memory pool, -1 (auto), 0 (disable) + --cpu-no-yield prefer maximum hashrate rather than system response/stability --no-huge-pages disable huge pages support --asm=ASM ASM optimizations, possible values: auto, none, intel, ryzen, bulldozer --randomx-init=N threads count to initialize RandomX dataset diff --git a/doc/CPU.md b/doc/CPU.md index c830590f..385af6ad 100644 --- a/doc/CPU.md +++ b/doc/CPU.md @@ -99,4 +99,7 @@ Allow override automatically detected Argon2 implementation, this option added m Maximum CPU threads count (in percentage) hint for autoconfig. [CPU_MAX_USAGE.md](CPU_MAX_USAGE.md) #### `memory-pool` (since v4.3.0) -Use continuous, persistent memory block for mining threads, useful for preserve huge pages allocation while algorithm swithing. Default value `false` (feature disabled) or `true` or specific count of 2 MB huge pages. +Use continuous, persistent memory block for mining threads, useful for preserve huge pages allocation while algorithm swithing. Possible values `false` (feature disabled, by default) or `true` or specific count of 2 MB huge pages. + +#### `yield` (since v5.1.1) +Prefer system better system response/stability `true` (default value) or maximum hashrate `false`. diff --git a/src/backend/cpu/CpuConfig.h b/src/backend/cpu/CpuConfig.h index 404b08fb..2306057f 100644 --- a/src/backend/cpu/CpuConfig.h +++ b/src/backend/cpu/CpuConfig.h @@ -73,7 +73,7 @@ private: bool m_enabled = true; bool m_hugePages = true; bool m_shouldSave = false; - bool m_yield = false; + bool m_yield = true; int m_memoryPool = 0; int m_priority = -1; String m_argon2Impl; diff --git a/src/base/kernel/interfaces/IConfig.h b/src/base/kernel/interfaces/IConfig.h index 5044545a..dbbf82cd 100644 --- a/src/base/kernel/interfaces/IConfig.h +++ b/src/base/kernel/interfaces/IConfig.h @@ -92,6 +92,7 @@ public: RandomXModeKey = 1029, CPUMaxThreadsKey = 1026, MemoryPoolKey = 1027, + YieldKey = 1030, // xmrig amd OclPlatformKey = 1400, diff --git a/src/config.json b/src/config.json index 26a7288a..df366c0f 100644 --- a/src/config.json +++ b/src/config.json @@ -25,7 +25,7 @@ "hw-aes": null, "priority": null, "memory-pool": false, - "yield": false, + "yield": true, "max-threads-hint": 100, "asm": true, "argon2-impl": null, diff --git a/src/core/config/ConfigTransform.cpp b/src/core/config/ConfigTransform.cpp index 667d9117..b9f66678 100644 --- a/src/core/config/ConfigTransform.cpp +++ b/src/core/config/ConfigTransform.cpp @@ -147,7 +147,9 @@ void xmrig::ConfigTransform::transform(rapidjson::Document &doc, int key, const case IConfig::MemoryPoolKey: /* --cpu-memory-pool */ return set(doc, kCpu, "memory-pool", static_cast(strtol(arg, nullptr, 10))); - break; + + case IConfig::YieldKey: /* --cpu-no-yield */ + return set(doc, kCpu, "yield", false); # ifdef XMRIG_FEATURE_ASM case IConfig::AssemblyKey: /* --asm */ diff --git a/src/core/config/Config_default.h b/src/core/config/Config_default.h index afd3638b..3db93a82 100644 --- a/src/core/config/Config_default.h +++ b/src/core/config/Config_default.h @@ -50,6 +50,7 @@ R"===( "colors": true, "randomx": { "init": -1, + "mode": "auto", "numa": true }, "cpu": { @@ -58,6 +59,7 @@ R"===( "hw-aes": null, "priority": null, "memory-pool": false, + "yield": true, "max-threads-hint": 100, "asm": true, "argon2-impl": null, diff --git a/src/core/config/Config_platform.h b/src/core/config/Config_platform.h index 608ac48e..a866c128 100644 --- a/src/core/config/Config_platform.h +++ b/src/core/config/Config_platform.h @@ -86,6 +86,7 @@ static const option options[] = { { "max-cpu-usage", 1, nullptr, IConfig::CPUMaxThreadsKey }, { "cpu-max-threads-hint", 1, nullptr, IConfig::CPUMaxThreadsKey }, { "cpu-memory-pool", 1, nullptr, IConfig::MemoryPoolKey }, + { "cpu-no-yield", 0, nullptr, IConfig::YieldKey }, # ifdef XMRIG_FEATURE_TLS { "tls", 0, nullptr, IConfig::TlsKey }, { "tls-fingerprint", 1, nullptr, IConfig::FingerprintKey }, diff --git a/src/core/config/usage.h b/src/core/config/usage.h index dcae30f4..38a48701 100644 --- a/src/core/config/usage.h +++ b/src/core/config/usage.h @@ -80,6 +80,7 @@ static inline const std::string &usage() u += " --cpu-priority set process priority (0 idle, 2 normal to 5 highest)\n"; u += " --cpu-max-threads-hint=N maximum CPU threads count (in percentage) hint for autoconfig\n"; u += " --cpu-memory-pool=N number of 2 MB pages for persistent memory pool, -1 (auto), 0 (disable)\n"; + u += " --cpu-no-yield prefer maximum hashrate rather than system response/stability\n"; u += " --no-huge-pages disable huge pages support\n"; u += " --asm=ASM ASM optimizations, possible values: auto, none, intel, ryzen, bulldozer\n";