Skip to content

Commit 57cad61

Browse files
committed
rt: Remove task pinning. Does nothing
1 parent 18de0f2 commit 57cad61

File tree

11 files changed

+9
-82
lines changed

11 files changed

+9
-82
lines changed

src/libcore/task.rs

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ export yield;
3737
export task_notification;
3838
export join;
3939
export unsupervise;
40-
export pin;
41-
export unpin;
4240
export task_result;
4341
export tr_success;
4442
export tr_failure;
@@ -64,9 +62,6 @@ type rust_closure = {
6462
#[link_name = "rustrt"]
6563
#[abi = "cdecl"]
6664
native mod rustrt {
67-
// these can run on the C stack:
68-
fn pin_task();
69-
fn unpin_task();
7065
fn get_task_id() -> task_id;
7166
fn rust_get_task() -> *rust_task;
7267

@@ -310,20 +305,6 @@ An unsupervised task will not propagate its failure up the task tree
310305
*/
311306
fn unsupervise() { ret sys::unsupervise(); }
312307

313-
/*
314-
Function: pin
315-
316-
Pins the current task and future child tasks to a single scheduler thread
317-
*/
318-
fn pin() { rustrt::pin_task(); }
319-
320-
/*
321-
Function: unpin
322-
323-
Unpin the current task and future child tasks
324-
*/
325-
fn unpin() { rustrt::unpin_task(); }
326-
327308
/*
328309
Function: currently_unwinding()
329310

src/rt/rust_builtin.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -380,18 +380,6 @@ nano_time(uint64_t *ns) {
380380
*ns = t.time_ns();
381381
}
382382

383-
extern "C" CDECL void
384-
pin_task() {
385-
rust_task *task = rust_scheduler::get_task();
386-
task->pin();
387-
}
388-
389-
extern "C" CDECL void
390-
unpin_task() {
391-
rust_task *task = rust_scheduler::get_task();
392-
task->unpin();
393-
}
394-
395383
extern "C" CDECL rust_task_id
396384
get_task_id() {
397385
rust_task *task = rust_scheduler::get_task();

src/rt/rust_scheduler.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -331,9 +331,6 @@ rust_scheduler::create_task(rust_task *spawner, const char *name,
331331
rust_task (this, &newborn_tasks, spawner, name, init_stack_sz);
332332
DLOG(this, task, "created task: " PTR ", spawner: %s, name: %s",
333333
task, spawner ? spawner->name : "null", name);
334-
if(spawner) {
335-
task->pin(spawner->pinned_on);
336-
}
337334

338335
{
339336
scoped_lock with(lock);

src/rt/rust_task.cpp

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,6 @@ rust_task::rust_task(rust_scheduler *sched, rust_task_list *state,
245245
next_port_id(0),
246246
rendezvous_ptr(0),
247247
running_on(-1),
248-
pinned_on(-1),
249248
local_region(&sched->srv->local_region),
250249
boxed(&local_region),
251250
unwinding(false),
@@ -628,29 +627,14 @@ rust_task::backtrace() {
628627
bool rust_task::can_schedule(int id)
629628
{
630629
return
631-
running_on == -1 &&
632-
(pinned_on == -1 || pinned_on == id);
630+
running_on == -1;
633631
}
634632

635633
void *
636634
rust_task::calloc(size_t size, const char *tag) {
637635
return local_region.calloc(size, tag);
638636
}
639637

640-
void rust_task::pin() {
641-
I(this->sched, running_on != -1);
642-
pinned_on = running_on;
643-
}
644-
645-
void rust_task::pin(int id) {
646-
I(this->sched, running_on == -1);
647-
pinned_on = id;
648-
}
649-
650-
void rust_task::unpin() {
651-
pinned_on = -1;
652-
}
653-
654638
rust_port_id rust_task::register_port(rust_port *port) {
655639
I(sched, !lock.lock_held_by_current_thread());
656640
scoped_lock with(lock);

src/rt/rust_task.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ rust_task : public kernel_owned<rust_task>, rust_cond
101101
// This flag indicates that a worker is either currently running the task
102102
// or is about to run this task.
103103
int running_on;
104-
int pinned_on;
105104

106105
memory_region local_region;
107106
boxed_region boxed;
@@ -180,10 +179,6 @@ rust_task : public kernel_owned<rust_task>, rust_cond
180179

181180
void *calloc(size_t size, const char *tag);
182181

183-
void pin();
184-
void pin(int id);
185-
void unpin();
186-
187182
rust_port_id register_port(rust_port *port);
188183
void release_port(rust_port_id id);
189184
rust_port *get_port_by_id(rust_port_id id);

src/rt/rustrt.def.in

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@ leak
2020
nano_time
2121
new_port
2222
new_task
23-
pin_task
2423
port_recv
25-
unpin_task
2624
rand_free
2725
rand_new
2826
rand_next

src/test/run-fail/morestack2.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88
use std;
99

1010
native mod rustrt {
11-
fn pin_task();
11+
fn do_gc();
1212
}
1313

1414
fn getbig_call_c_and_fail(i: int) {
1515
if i != 0 {
1616
getbig_call_c_and_fail(i - 1);
1717
} else {
18-
rustrt::pin_task();
18+
rustrt::do_gc();
1919
fail;
2020
}
2121
}

src/test/run-pass/bind-native.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Can we bind native things?
44

55
#[abi = "cdecl"]
66
native mod rustrt {
7-
fn pin_task();
7+
fn do_gc();
88
}
99

10-
fn main() { bind rustrt::pin_task(); }
10+
fn main() { bind rustrt::do_gc(); }

src/test/run-pass/morestack6.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ native mod rustrt {
1313
fn rust_getcwd() -> str;
1414
fn refcount(box: @int);
1515
fn do_gc();
16-
fn pin_task();
17-
fn unpin_task();
1816
fn get_task_id();
1917
fn sched_threads();
2018
fn rust_get_task();
@@ -25,8 +23,6 @@ fn calllink02() { rustrt::last_os_error(); }
2523
fn calllink03() { rustrt::rust_getcwd(); }
2624
fn calllink04() { rustrt::refcount(@0); }
2725
fn calllink05() { rustrt::do_gc(); }
28-
fn calllink06() { rustrt::pin_task(); }
29-
fn calllink07() { rustrt::unpin_task(); }
3026
fn calllink08() { rustrt::get_task_id(); }
3127
fn calllink09() { rustrt::sched_threads(); }
3228
fn calllink10() { rustrt::rust_get_task(); }
@@ -60,8 +56,6 @@ fn main() {
6056
calllink03,
6157
calllink04,
6258
calllink05,
63-
calllink06,
64-
calllink07,
6559
calllink08,
6660
calllink09,
6761
calllink10

src/test/run-pass/native-dupe.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@
44
#[abi = "cdecl"]
55
#[link_name = "rustrt"]
66
native mod rustrt1 {
7-
fn pin_task();
7+
fn do_gc();
88
}
99

1010
#[abi = "cdecl"]
1111
#[link_name = "rustrt"]
1212
native mod rustrt2 {
13-
fn pin_task();
13+
fn do_gc();
1414
}
1515

1616
fn main() {
17-
rustrt1::pin_task();
18-
rustrt2::pin_task();
17+
rustrt1::do_gc();
18+
rustrt2::do_gc();
1919
}

src/test/run-pass/task-pin.rs

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)