lkml.org 
[lkml]   [2015]   [Apr]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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



\
 
 \ /
  Last update: 2015-04-23 19:01    [W:0.041 / U:0.712 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site