Messages in this thread | | | Date | Thu, 23 Apr 2015 10:51:59 -0600 | From | Jens Axboe <> | Subject | Re: [PATCH] cciss: Optimize scan_thread |
| |
On 04/22/2015 12:43 PM, Davidlohr Bueso wrote: > Two rather small optimizations found while going through driver > code: > > 1) Use the cheaper alternative to set_current_state() as we are > sure the task will block right afterward. > > 2) Checks for list_empty without the scan_mutex. The list_empty > function is very much designed to work without locks, obviously > as long as the head (scan_q) is reliable. In this case if another > thread is doing add_to_scan_list(), we still buckle in the outer > loop, so it will be caught upon the next iteration -- and if > kthread_should_stop() hits, it does not matter _anyway_ as we'd > still need to abort the function regardless of the status of > the scan_q.
Not that it's wrong, but this is mostly some unneeded optimizations. It's not like this is in a hot path.
-- Jens Axboe
| |