Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030344AbbDWQwE (ORCPT ); Thu, 23 Apr 2015 12:52:04 -0400 Received: from mail-ie0-f169.google.com ([209.85.223.169]:34678 "EHLO mail-ie0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030254AbbDWQwC (ORCPT ); Thu, 23 Apr 2015 12:52:02 -0400 Message-ID: <5539232F.4050404@kernel.dk> Date: Thu, 23 Apr 2015 10:51:59 -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> In-Reply-To: <1429728220.10273.26.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: 1078 Lines: 27 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 -- 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/