Skip to content
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

very basic work-stealing #629

Merged
merged 3 commits into from
Dec 2, 2024
Merged

very basic work-stealing #629

merged 3 commits into from
Dec 2, 2024

Conversation

lihuiba
Copy link
Collaborator

@lihuiba lihuiba commented Dec 1, 2024

No description provided.

stack_size = DEFAULT_STACK_SIZE;
if (unlikely((uint64_t)reserved_space > stack_size / 2))
LOG_ERROR_RETURN(EINVAL, nullptr, VALUE(reserved_space), "must be <= half of ", VALUE(stack_size));
uint64_t FLAGS = THREAD_JOINABLE | THREAD_ENABLE_WORK_STEALING;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FLAGS looks like just a simple const value, should be defined as const or constexpr.

@@ -1884,7 +2018,11 @@ R"(
return _n_vcpu.load(std::memory_order_relaxed);
}

int vcpu_init() {
int vcpu_init(uint64_t flags) {
uint64_t FLAGS = VCPU_ENABLE_ACTIVE_WORK_STEALING |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const/constexpr

@@ -61,8 +65,10 @@ namespace photon
const uint64_t DEFAULT_STACK_SIZE = 8 * 1024 * 1024;
// Thread stack size should be at least 16KB. The thread struct located at stack bottom,
// and the mprotect page is located at stack top-end.
// reserved_space must be <= stack_size / 2
thread* thread_create(thread_entry start, void* arg,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thread_create now able to set THREAD_ENALBE_WORK_STEALING when creating, but still need methods to enable/disable stealing for thread temporary.

Copy link
Collaborator

@Coldwings Coldwings left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lihuiba lihuiba merged commit 4857bc7 into alibaba:main Dec 2, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants