@@ -149,12 +149,12 @@ impl Driver {
149149 }
150150
151151 // Auto means that it choose to wait or not automatically.
152- fn submit_auto ( & mut self , timeout : Option < Duration > ) -> io:: Result < ( ) > {
152+ fn submit_auto ( & mut self , timeout : Option < Duration > , need_wait : bool ) -> io:: Result < ( ) > {
153153 instrument ! ( compio_log:: Level :: TRACE , "submit_auto" , ?timeout) ;
154154
155155 // when taskrun is true, there are completed cqes wait to handle, no need to
156156 // block the submit
157- let want_sqe = if self . inner . submission ( ) . taskrun ( ) {
157+ let want_sqe = if !need_wait || self . inner . submission ( ) . taskrun ( ) {
158158 0
159159 } else {
160160 1
@@ -196,14 +196,10 @@ impl Driver {
196196 has_entry
197197 }
198198
199- fn poll_entries ( & mut self , hot_path : bool ) -> bool {
199+ fn poll_entries ( & mut self ) -> bool {
200200 let mut cqueue = self . inner . completion ( ) ;
201201 cqueue. sync ( ) ;
202202 let has_entry = !cqueue. is_empty ( ) ;
203- // TODO: likely hint
204- if hot_path {
205- self . notifier . set_awake ( true ) ;
206- }
207203 for entry in cqueue {
208204 match entry. user_data ( ) {
209205 Self :: CANCEL => { }
@@ -235,9 +231,6 @@ impl Driver {
235231 }
236232 }
237233 }
238- if hot_path {
239- self . notifier . set_awake ( false ) ;
240- }
241234 has_entry
242235 }
243236
@@ -289,7 +282,7 @@ impl Driver {
289282 }
290283 Err ( _) => {
291284 drop ( squeue) ;
292- match self . submit_auto ( Some ( Duration :: ZERO ) ) {
285+ match self . submit_auto ( Some ( Duration :: ZERO ) , true ) {
293286 Ok ( ( ) ) => { }
294287 Err ( e)
295288 if matches ! (
@@ -303,7 +296,7 @@ impl Driver {
303296 // event indefinitely.
304297 //
305298 // Anyway it is not a hot path, so we can afford an extra `write` syscall here.
306- self . poll_entries ( false ) ;
299+ self . poll_entries ( ) ;
307300 }
308301 }
309302 }
@@ -372,6 +365,8 @@ impl Driver {
372365
373366 trace ! ( "start polling" ) ;
374367
368+ let need_wait = !self . notifier . reset ( ) ;
369+
375370 if self . need_push_notifier {
376371 #[ allow( clippy:: useless_conversion) ]
377372 self . push_raw (
@@ -384,8 +379,10 @@ impl Driver {
384379 self . need_push_notifier = false ;
385380 }
386381
387- self . submit_auto ( timeout) ?;
388- self . poll_entries ( true ) ;
382+ self . submit_auto ( timeout, need_wait) ?;
383+
384+ self . notifier . set_awake ( ) ;
385+ self . poll_entries ( ) ;
389386
390387 Ok ( ( ) )
391388 }
0 commit comments