Messages in this thread | | | Date | Thu, 23 Apr 2015 11:11:02 -0600 | From | Jens Axboe <> | Subject | Re: [PATCH] cciss: Optimize scan_thread |
| |
On 04/23/2015 11:06 AM, Davidlohr Bueso wrote: > On Thu, 2015-04-23 at 10:51 -0600, Jens Axboe wrote: >> Not that it's wrong, but this is mostly some unneeded optimizations. >> It's not like this is in a hot path. > > Most definitely small optimizations, I just happened to run into > auditing schedule calls. Still no harm in applying.
Are you sure? What happens if scan_thread() races with pci removal? The list was non-empty, enter the loop. PCI removal removes the device from the scan list. Now we grab the lock in scan_thread(), and unconditionally attempt to remove an entry from scan_q. Maybe something protects us from this, maybe it doesn't.
So IOW, I don't like your lock optimization, it's a bad idea. The __set_current_state() change is definitely fine, though.
-- Jens Axboe
| |