diff --git a/kernel/brick_wait.h b/kernel/brick_wait.h index b4fe9064..5abfce5b 100644 --- a/kernel/brick_wait.h +++ b/kernel/brick_wait.h @@ -30,26 +30,32 @@ #define brick_wait(wq, flag, condition, timeout) \ ({ \ unsigned long __tmout = (timeout); \ + int __old_flag; \ \ might_sleep(); \ - (flag) = false; \ - smp_wmb(); \ + smp_rmb(); \ + __old_flag = (flag); \ + \ while (!(condition)) { \ + int __new_flag; \ + \ __tmout = wait_event_interruptible_timeout( \ wq, \ - ({ smp_rmb(); (flag); }), \ + ({ smp_rmb(); \ + __new_flag = (flag); \ + __old_flag != __new_flag; }), \ __tmout); \ if (__tmout <= 1) \ break; \ - (flag) = false; \ - smp_wmb(); \ + __old_flag = __new_flag; \ } \ __tmout; \ }) #define brick_wake(wq, flag) \ ({ \ - (flag) = true; \ + smp_rmb(); \ + (flag)++; \ smp_wmb(); \ wake_up_interruptible_all(wq); \ }) diff --git a/kernel/lib_log.h b/kernel/lib_log.h index 0986ba88..f84244c3 100644 --- a/kernel/lib_log.h +++ b/kernel/lib_log.h @@ -253,7 +253,7 @@ int log_scan(void *buf, int len, loff_t file_pos, int file_offset, bool sloppy, struct log_status { // interfacing wait_queue_head_t *signal_event; - bool *signal_flag; + int *signal_flag; // tunables loff_t start_pos; loff_t end_pos; diff --git a/kernel/mars_trans_logger.h b/kernel/mars_trans_logger.h index 11221b2a..264a268b 100644 --- a/kernel/mars_trans_logger.h +++ b/kernel/mars_trans_logger.h @@ -240,9 +240,9 @@ struct trans_logger_brick { // queues struct logger_queue q_phase[LOGGER_QUEUES]; struct rank_data rkd[LOGGER_QUEUES]; + int caller_flag; + int worker_flag; bool delay_callers; - bool caller_flag; - bool worker_flag; /* termination */ bool terminate; bool terminated;