Commit ad138aae authored by Vikram Narayanan's avatar Vikram Narayanan

test_mods/nullnet: Implement RR scheduling

Messages from the queue are always peeked from list head which affects
fairness. Fix it by bringing the list peeking into LCD's main loop.
parent 32e48efc
......@@ -38,6 +38,7 @@ static void main_and_loop(void)
unsigned long long disp_loop_cycles = 0, percent = 0;
#endif
struct fipc_message *msg;
DO_FINISH(
ASYNC(
......@@ -86,67 +87,74 @@ static void main_and_loop(void)
disp_loop_cycles = 0;
}
start_disp = lcd_RDTSC_START();
#endif
/*
* Do one async receive
* Do RR async receive
*/
//ret = thc_poll_recv_group(&ch_grp, &curr_item, &msg);
ret = thc_poll_recv_group_2(&ch_grp, &curr_item, &msg);
if (likely(ret)) {
if (ret == -EWOULDBLOCK) {
cpu_relax();
continue;
list_for_each_entry(curr_item, &(ch_grp.head), list) {
if (curr_item->xmit_channel) {
ret = fipc_nonblocking_recv_start_if(
thc_channel_to_fipc(
thc_channel_group_item_channel(curr_item)),
&msg);
} else {
LIBLCD_ERR("async recv failed");
stop = 1; /* stop */
ret = thc_ipc_poll_recv(thc_channel_group_item_channel(curr_item),
&msg);
}
}
if (async_msg_get_fn_type(msg) == NDO_START_XMIT) {
if (fipc_get_reg0(msg)) {
// printk("%s, chain skb", __func__);
ret = ndo_start_xmit_async_bare_callee(msg,
curr_item->channel,
nullnet_cspace,
nullnet_sync_endpoint);
} else {
ret = ndo_start_xmit_noawe_callee(msg,
curr_item->channel,
nullnet_cspace,
nullnet_sync_endpoint);
}
if (likely(ret)) {
LIBLCD_ERR("async dispatch failed");
stop = 1;
if( !ret )
{
start_disp = lcd_RDTSC_START();
/* message for us */
if (async_msg_get_fn_type(msg) == NDO_START_XMIT) {
if (fipc_get_reg0(msg)) {
ret = ndo_start_xmit_async_bare_callee(msg,
curr_item->channel,
nullnet_cspace,
nullnet_sync_endpoint);
} else {
ret = ndo_start_xmit_noawe_callee(msg,
curr_item->channel,
nullnet_cspace,
nullnet_sync_endpoint);
}
if (likely(ret)) {
LIBLCD_ERR("async dispatch failed");
stop = 1;
}
} else {
ASYNC(
ret = dispatch_async_loop(curr_item->channel,
msg,
nullnet_cspace,
nullnet_sync_endpoint);
if (ret) {
LIBLCD_ERR("async dispatch failed");
stop = 1;
}
);
}
#ifdef REPORT_LCD_LOAD
end_disp = lcd_RDTSC_STOP();
disp_loop_cycles += (end_disp - start_disp);
#endif
}
}
} else {
ASYNC(
ret = dispatch_async_loop(curr_item->channel,
msg,
nullnet_cspace,
nullnet_sync_endpoint);
if (ret) {
LIBLCD_ERR("async dispatch failed");
stop = 1;
}
);
if (ret == -EWOULDBLOCK) {
cpu_relax();
continue;
}
#ifdef REPORT_LCD_LOAD
end_disp = lcd_RDTSC_STOP();
disp_loop_cycles += (end_disp - start_disp);
#endif
}
LIBLCD_MSG("NULLNET EXITED DISPATCH LOOP");
);
LIBLCD_MSG("EXITED PMFS DO_FINISH");
LIBLCD_MSG("EXITED NULLNET DO_FINISH");
return;
}
......@@ -212,4 +220,3 @@ static void __exit dummy_lcd_exit(void)
module_init(__dummy_lcd_init);
module_exit(dummy_lcd_exit);
MODULE_LICENSE("GPL");
......@@ -82,7 +82,7 @@ int setup_once(struct trampoline_hidden_args *hidden_args)
prep_channel(hidden_args);
printk("===================================\n");
printk("===== Private Channel created =====\n");
printk("===== Private Channel created (pid %d) =====\n", current->pid);
printk("===================================\n");
if (thread < 4) {
current->ptstate->times_ndo_xmit = times_ndo_xmit[thread++];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment