Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030457AbbDWRLI (ORCPT ); Thu, 23 Apr 2015 13:11:08 -0400 Received: from mail-ig0-f176.google.com ([209.85.213.176]:38091 "EHLO mail-ig0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030297AbbDWRLE (ORCPT ); Thu, 23 Apr 2015 13:11:04 -0400 Message-ID: <553927A6.2050407@kernel.dk> Date: Thu, 23 Apr 2015 11:11:02 -0600 From: Jens Axboe User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Davidlohr Bueso CC: Mike Miller , Don Brace , iss_storagedev@hp.com, storagedev@pmcs.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH] cciss: Optimize scan_thread References: <1429728220.10273.26.camel@stgolabs.net> <5539232F.4050404@kernel.dk> <1429808789.10273.37.camel@stgolabs.net> In-Reply-To: <1429808789.10273.37.camel@stgolabs.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1044 Lines: 25 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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/