Skip to content

Limited the existence of a TID to one at a time #2012

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jahdiel-alvarez
Copy link
Contributor

ProcessTracker permitted the creation of multiple threads with same TID but different UTIDs, mainly to address data loss scenarios. Refactored the code to have better semantics to address these cases. The ClearThread method removes all preexisting UTIDs from the active thread map, acting as a barrier point from which a new thread can be created for a preexisting TID.

Also, updated the API so that GetOrCreateThread becomes the primary thread creation method, forcing a single TID and thread association at any point in time.

Bug: 425694654

ProcessTracker permitted the creation of multiple threads with same
TID but different UTIDs, mainly to address data loss scenarios.
Refactored the code to have better semantics to address these cases.
The ClearThread method removes all preexisting UTIDs from the active
thread map, acting as a barrier point from which a new thread can be
created for a preexisting TID.

Also, updated the API so that GetOrCreateThread becomes the primary
thread creation method, forcing a single TID and thread association at
any point in time.

Bug: 425694654
@jahdiel-alvarez jahdiel-alvarez requested a review from a team as a code owner July 2, 2025 21:57
@@ -146,7 +146,8 @@ std::optional<UniqueTid> GenericKernelParser::GetUtidForState(int64_t ts,
stats::generic_task_state_invalid_order);
return std::nullopt;
}
UniqueTid utid = context_->process_tracker->StartNewThread(ts, tid);
UniqueTid utid = context_->process_tracker->GetOrCreateThread(tid);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Shouldn't you ClearThread here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@LalitMaganti Not really because we are already explicitly checking above that the thread doesn't exist (line 144).

Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you add a comment then?

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