Skip to content

Commit 88648b8

Browse files
committed
---
yaml --- r: 30061 b: refs/heads/incoming c: 5ba7434 h: refs/heads/master i: 30059: d808ea9 v: v3
1 parent 0976935 commit 88648b8

File tree

3 files changed

+14
-11
lines changed

3 files changed

+14
-11
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: d324a424d8f84b1eb049b12cf34182bda91b0024
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: d0c6ce338884ee21843f4b40bf6bf18d222ce5df
9-
refs/heads/incoming: e55c5ceac239417784f9fe8c37f92e974b9cc06e
9+
refs/heads/incoming: 5ba7434cb17c19438b00730b37741f2d61449ad8
1010
refs/heads/dist-snap: 2f32a1581f522e524009138b33b1c7049ced668d
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/incoming/src/rt/rust_task.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,13 @@ MUST_CHECK bool rust_task::yield() {
248248

249249
// This check is largely superfluous; it's the one after the context swap
250250
// that really matters. This one allows us to assert a useful invariant.
251+
252+
// NB: This takes lifecycle_lock three times, and I believe that none of
253+
// them are actually necessary, as per #3213. Removing the locks here may
254+
// cause *harmless* races with a killer... but I didn't observe any
255+
// substantial performance improvement from removing them, even with
256+
// msgsend-ring-pipes, and also it's my last day, so I'm not about to
257+
// remove them. -- bblum
251258
if (must_fail_from_being_killed()) {
252259
{
253260
scoped_lock with(lifecycle_lock);

branches/incoming/src/rt/rust_task.h

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -431,12 +431,11 @@ rust_task::call_on_rust_stack(void *args, void *fn_ptr) {
431431
assert(get_sp_limit() != 0 && "Stack must be configured");
432432
assert(next_rust_sp);
433433

434-
bool had_reentered_rust_stack;
435-
{
436-
scoped_lock with(lifecycle_lock);
437-
had_reentered_rust_stack = reentered_rust_stack;
438-
reentered_rust_stack = true;
439-
}
434+
// Unlocked access. Might "race" a killer, but harmlessly. This code is
435+
// only run by the task itself, so cannot race itself. See the comment
436+
// above inhibit_kill (or #3213) in rust_task.cpp for justification.
437+
bool had_reentered_rust_stack = reentered_rust_stack;
438+
reentered_rust_stack = true;
440439

441440
uintptr_t prev_c_sp = next_c_sp;
442441
next_c_sp = get_sp();
@@ -448,10 +447,7 @@ rust_task::call_on_rust_stack(void *args, void *fn_ptr) {
448447
__morestack(args, fn_ptr, sp);
449448

450449
next_c_sp = prev_c_sp;
451-
{
452-
scoped_lock with(lifecycle_lock);
453-
reentered_rust_stack = had_reentered_rust_stack;
454-
}
450+
reentered_rust_stack = had_reentered_rust_stack;
455451

456452
record_sp_limit(0);
457453
}

0 commit comments

Comments
 (0)