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

[catnap] Enhancement: Yield to kernel #1295

Draft
wants to merge 1 commit into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions src/rust/catnap/linux/transport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@ mod socket;
//======================================================================================================================

use crate::{
catnap::transport::socket::{
SharedSocketData,
SocketData,
catnap::{
transport::socket::{
SharedSocketData,
SocketData,
},
YIELD_TIMEOUT_MS,
},
demikernel::config::Config,
expect_ok,
Expand Down Expand Up @@ -173,7 +176,7 @@ impl SharedCatnapTransport {
self.epoll_fd,
events.as_mut_ptr() as *mut libc::epoll_event,
EPOLL_BATCH_SIZE as i32,
0,
YIELD_TIMEOUT_MS as i32,
)
} {
result if result >= 0 => {
Expand Down
2 changes: 2 additions & 0 deletions src/rust/catnap/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@
#[cfg_attr(target_os = "linux", path = "linux/transport.rs")]
#[cfg_attr(target_os = "windows", path = "win/transport.rs")]
pub mod transport;

const YIELD_TIMEOUT_MS: u32 = 1;
15 changes: 13 additions & 2 deletions src/rust/catnap/win/overlapped.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ use windows::Win32::{
};

use crate::{
catnap::transport::error::translate_ntstatus,
catnap::{
transport::error::translate_ntstatus,
YIELD_TIMEOUT_MS,
},
collections::pin_slab::PinSlab,
expect_some,
runtime::{
Expand Down Expand Up @@ -245,7 +248,15 @@ impl<S: Unpin> IoCompletionPort<S> {

loop {
let mut dequeued: u32 = 0;
match unsafe { GetQueuedCompletionStatusEx(self.iocp, entries.as_mut_slice(), &mut dequeued, 0, FALSE) } {
match unsafe {
GetQueuedCompletionStatusEx(
self.iocp,
entries.as_mut_slice(),
&mut dequeued,
YIELD_TIMEOUT_MS,
FALSE,
)
} {
Ok(()) => {
for i in 0..dequeued {
self.process_overlapped(&entries[i as usize]);
Expand Down
Loading