| 1478 | } |
| 1479 | |
| 1480 | static void do_stack_pages_gc(void* arg) { |
| 1481 | #if !defined(_WIN64) && !defined(__aarch64__) |
| 1482 | auto th = (thread*)arg; |
| 1483 | assert(th->vcpu == CURRENT->vcpu); |
| 1484 | auto buf = th->buf; |
| 1485 | if (buf == nullptr) { |
| 1486 | // th is the main thread of the vcpu |
| 1487 | return; |
| 1488 | } |
| 1489 | auto rsp = (char*)th->stack._ptr; |
| 1490 | auto len = align_down(rsp - buf, PAGE_SIZE); |
| 1491 | madvise(buf, len, MADV_DONTNEED); |
| 1492 | #endif |
| 1493 | } |
| 1494 | |
| 1495 | int stack_pages_gc(thread* th) { |
| 1496 | if (!th || th->vcpu != CURRENT->vcpu) |
no test coverage detected