Re: [PATCH] cciss: Optimize scan_thread

From: Jens Axboe
Date: Thu Apr 23 2015 - 13:11:11 EST


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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/