-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set specific sliced pages for read-only threads in EOS VM OC Tierup #1498
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
d175de6
Use sliced_pages_for_ro_thread EOS VM OC Tierup
linh2931 0352ec5
Keep original 529 sliced pages for main thread OC tierup; make sure t…
linh2931 1923622
Add a test to verify virtual memory taking by OC does not grow by TBs…
linh2931 75c5ebb
skip OC test if platform is not Linux
linh2931 8891fff
Merge branch 'main' into oc_tier_ro_thread_mem_fonfig
linh2931 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,8 @@ | |
import time | ||
import signal | ||
import threading | ||
import os | ||
import platform | ||
|
||
from TestHarness import Account, Cluster, ReturnType, TestHelper, Utils, WalletMgr | ||
from TestHarness.TestHelper import AppArgs | ||
|
@@ -109,6 +111,9 @@ def startCluster(): | |
specificExtraNodeosArgs[pnodes]+=" --read-only-threads " | ||
specificExtraNodeosArgs[pnodes]+=str(args.read_only_threads) | ||
if args.eos_vm_oc_enable: | ||
if platform.system() != "Linux": | ||
Print("OC not run on Linux. Skip the test") | ||
exit(True) # Do not fail the test | ||
specificExtraNodeosArgs[pnodes]+=" --eos-vm-oc-enable " | ||
specificExtraNodeosArgs[pnodes]+=args.eos_vm_oc_enable | ||
if args.wasm_runtime: | ||
|
@@ -132,6 +137,29 @@ def startCluster(): | |
found = producerNode.findInLog(f"executing {eosioCodeHash} with eos vm oc") | ||
assert( found or (noOC and not found) ) | ||
|
||
if args.eos_vm_oc_enable: | ||
verifyOcVirtualMemory() | ||
|
||
def verifyOcVirtualMemory(): | ||
try: | ||
with open(f"/proc/{apiNode.pid}/statm") as f: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I realize it doesn't matter now since OC is linux only, but it might be nice to skip this test on non-Linux if that's easy to do. |
||
data = f.read().split() | ||
vmPages = int(data[0]) | ||
pageSize = os.sysconf("SC_PAGESIZE") | ||
actualVmSize = vmPages * pageSize | ||
|
||
# When OC tierup is enabled, virtual memory used by IC is around | ||
# 529 slices * 8GB (for main thread) + numReadOnlyThreads * 11 slices * 8GB | ||
# This test verifies virtual memory taken by one read-only thread | ||
# is not in the order of 1TB. | ||
otherGB = 1000 # add 1TB for virtual memory used by others | ||
expectedVmSize = ((529 * 8) + (args.read_only_threads * 88) + otherGB) * 1024 * 1024 * 1024 | ||
Utils.Print(f"pid: {apiNode.pid}, actualVmSize: {actualVmSize}, expectedVmSize: {expectedVmSize}") | ||
assert(actualVmSize < expectedVmSize) | ||
except FileNotFoundError: | ||
Utils.Print(f"/proc/{apiNode.pid}/statm not found") | ||
assert(False) | ||
|
||
def deployTestContracts(): | ||
Utils.Print("create test accounts") | ||
testAccount = Account(testAccountName) | ||
|
@@ -348,4 +376,4 @@ def runEverythingParallel(): | |
TestHelper.shutdown(cluster, walletMgr, testSuccessful, dumpErrorDetails) | ||
|
||
errorCode = 0 if testSuccessful else 1 | ||
exit(errorCode) | ||
exit(errorCode) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(obviously not in this PR) but I'd really like for us to noodle on how to move away from these
thread_local
s, they have dangerous lifetime semantics imo. In this particular example, wheneosvmoc_tier
is destroyed,cc
is destroyed, but theexec
created with a reference to thatcc
lives on. So ifexecutor
's dtor (which will run well aftereosvmoc_tier
's dtor) touches thecode_cache_async
that was passed to it via reference: bad news! It's a real trap -- passing a reference to some object to the ctor of an object implies that reference will be valid for the lifetime of the object.. but it's not true here.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. I will be looking into moving away from those thread_locals.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I created #1503 to track this. Will work on it soon.