From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751632AbeDNBPX (ORCPT ); Fri, 13 Apr 2018 21:15:23 -0400 Received: from mga04.intel.com ([192.55.52.120]:57230 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750867AbeDNBPV (ORCPT ); Fri, 13 Apr 2018 21:15:21 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,446,1517904000"; d="scan'208";a="216496904" Date: Fri, 13 Apr 2018 20:15:17 -0500 From: Shiraz Saleem To: Dennis Dalessandro Cc: Jia-Ju Bai , faisal.latif@intel.com, dledford@redhat.com, sean.hefty@intel.com, hal.rosenstock@gmail.com, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/3] infiniband: i40iw: Replace GFP_ATOMIC with GFP_KERNEL in i40iw_add_mqh_4 Message-ID: <20180414011517.GD18392@ssaleem-MOBL4.amr.corp.intel.com> References: <1523431945-3508-1-git-send-email-baijiaju1990@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.7.2 (2016-11-26) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 11, 2018 at 10:53:13AM -0400, Dennis Dalessandro wrote: > On 4/11/2018 3:32 AM, Jia-Ju Bai wrote: > > i40iw_add_mqh_4() is never called in atomic context, because it > > calls rtnl_lock() that can sleep. > > > > Despite never getting called from atomic context, > > i40iw_add_mqh_4() calls kzalloc() with GFP_ATOMIC, > > which does not sleep for allocation. > > GFP_ATOMIC is not necessary and can be replaced with GFP_KERNEL, > > which can sleep and improve the possibility of sucessful allocation. > > Just a general comment. I don't know that this is the greatest idea. I can > imagine instances where sleeping is OK as far as how the code is written, > but for performance reasons you would rather fail than sleep. > > As to whether that is the case here I'll let the i40iw folks comment. > In this case, the changes Jia made look safe and not in the perf. path. Thanks! > > This is found by a static analysis tool named DCNS written by myself. > > And I also manually check it. > You should probably post a pointer to your tool. > > -Denny