From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751120AbdAaI5c (ORCPT ); Tue, 31 Jan 2017 03:57:32 -0500 Received: from userp1040.oracle.com ([156.151.31.81]:35632 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750726AbdAaI5Y (ORCPT ); Tue, 31 Jan 2017 03:57:24 -0500 Date: Tue, 31 Jan 2017 11:55:42 +0300 From: Dan Carpenter To: James Simmons Cc: Greg Kroah-Hartman , devel@driverdev.osuosl.org, Andreas Dilger , Oleg Drokin , Fan Yong , Linux Kernel Mailing List , Lustre Development List Subject: Re: [PATCH 22/60] staging: lustre: fid: fix race in fid allocation Message-ID: <20170131085542.GI6881@mwanda> References: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> <1485648328-2141-23-git-send-email-jsimmons@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1485648328-2141-23-git-send-email-jsimmons@infradead.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-Source-IP: userv0022.oracle.com [156.151.31.74] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jan 28, 2017 at 07:04:50PM -0500, James Simmons wrote: > - if (!fid_is_zero(&seq->lcs_fid) && > - fid_oid(&seq->lcs_fid) < seq->lcs_width) { > + if (unlikely(!fid_is_zero(&seq->lcs_fid) && > + fid_oid(&seq->lcs_fid) < seq->lcs_width)) { What does adding an unlikely have to do with the race condition? Also only add likely/unlikely when it makes a difference to benchmarks. Otherwise leave it out. > /* Just bump last allocated fid and return to caller. */ > - seq->lcs_fid.f_oid += 1; > + seq->lcs_fid.f_oid++; Ok... I'm pretty sure the compiler can figure this out on its own. Stop mixing white space changes into your bug fixes. It just makes reviewing more complicated. > rc = 0; > break; > } > regards, dan carpenter