Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp642340pxa; Sat, 1 Aug 2020 01:11:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwjcIw7pLZX4J9q10o0C2Iq0BNiixstQBIddrZoQISelcJxyDPpQog9uiOoRGX9M5XASMFf X-Received: by 2002:a17:906:b157:: with SMTP id bt23mr8114175ejb.354.1596269465862; Sat, 01 Aug 2020 01:11:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596269465; cv=none; d=google.com; s=arc-20160816; b=fbkdjM3Fwo1C++nwSL4kMyRItKVY7mvnXJC+zlNV6ctsSNUdeFmEdmmFMd61Hv/Nhl lh2BhWYhT4jOOAPTmlcU3fMaoqR3ItV1+0AXhDJjrWyQQm4K8bKOqOTBwbZjup6TzVEr 3HZlGH2F+FZwYUR2K3gAwwKfqjQxJKX5Cxml7rOO3L/xukSxdae9ls4N7uffmJB0/bKn 9suHHQjBYi2k6x7ob7sfawmEjr1Uw/YdYEauC3KtDgZSkx065eJ/cbjfKlZjbAZXfnjk /ru5LxlDyNkVBR3RkMKqxpVUMKq8kgiAnOKsWKIN+RUIrUEIHtXzppNKznVT7dramoJz Ylhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=DKW7OvdcARiaTrDxxB2T7HrVJi9qv3hImHKRqFV1qgo=; b=v1J7PV+TD/6hbrr/Xd4OnWOpHnktZKpxyVowwU3agCHpKXkPx1BuOlMrWJrn/v4m/D cpuDPVkitjo3/LgQ+FhRorLu8GkdEqFYjvV3L9q2exlXoBxEw03NferFyYESG0Pzr9vo J0hYEvga0q6ovTpYZl8dqd2NfonrdhgjfIAsfMbRTte2Ve0vyelN97ltv+2xr1nIEpQu eGseAot2ZEQGFKD/voH6SRMb7NNjmW33hmMpeRAk6itlCZoUwA1Y00+MI9sa0UcA5Nt6 o31+NovBmJZEWiTJxRMxw3wT8QqLt+tMGuZhFo9GAmC+uiZqEA2Sa8sqLgqIk3s63x51 RH0w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gh13si6476040ejb.3.2020.08.01.01.10.41; Sat, 01 Aug 2020 01:11:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727984AbgHAIKc (ORCPT + 99 others); Sat, 1 Aug 2020 04:10:32 -0400 Received: from smtprelay0163.hostedemail.com ([216.40.44.163]:39208 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725283AbgHAIKc (ORCPT ); Sat, 1 Aug 2020 04:10:32 -0400 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay06.hostedemail.com (Postfix) with ESMTP id 314001800F08E; Sat, 1 Aug 2020 08:10:31 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 50,0,0,,d41d8cd98f00b204,joe@perches.com,,RULES_HIT:41:355:379:599:966:967:968:973:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2110:2196:2199:2393:2525:2560:2563:2682:2685:2692:2828:2859:2933:2937:2939:2942:2945:2947:2951:2954:3022:3138:3139:3140:3141:3142:3353:3622:3865:3867:3868:3871:3872:3873:3934:3936:3938:3941:3944:3947:3950:3953:3956:3959:4321:4385:5007:6119:7903:8660:9025:10004:10400:10848:11026:11232:11233:11658:11914:12043:12295:12296:12297:12438:12740:12760:12895:13069:13071:13095:13148:13161:13163:13229:13230:13311:13357:13439:14096:14097:14180:14181:14659:14721:21060:21080:21220:21433:21451:21627:21939:30054:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:3,LUA_SUMMARY:none X-HE-Tag: bears44_4f154d426f8a X-Filterd-Recvd-Size: 2765 Received: from XPS-9350.home (unknown [47.151.133.149]) (Authenticated sender: joe@perches.com) by omf14.hostedemail.com (Postfix) with ESMTPA; Sat, 1 Aug 2020 08:10:29 +0000 (UTC) Message-ID: <0c1803c6aaca42579b7933fd219e4e208ab7524f.camel@perches.com> Subject: Re: [PATCH] scsi: libcxgbi: use kvzalloc instead of opencoded kzalloc/vzalloc From: Joe Perches To: Denis Efremov , "Martin K. Petersen" , "James E.J. Bottomley" Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Date: Sat, 01 Aug 2020 01:10:28 -0700 In-Reply-To: References: <20200731215524.14295-1-efremov@linux.com> <33d943d2b83f17371df09b5962c856ea2d894954.camel@perches.com> <70fb8220-2102-adb5-bbe6-9c2ea74a0623@linux.com> <8638183f559c0f8f8d377bd0a6c91903b2c588df.camel@perches.com> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.36.3-0ubuntu1 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 2020-08-01 at 10:51 +0300, Denis Efremov wrote: > On 8/1/20 1:24 AM, Joe Perches wrote: > > On Sat, 2020-08-01 at 01:10 +0300, Denis Efremov wrote: > > > On 8/1/20 12:58 AM, Joe Perches wrote: > > > > On Sat, 2020-08-01 at 00:55 +0300, Denis Efremov wrote: > > > > > Remove cxgbi_alloc_big_mem(), cxgbi_free_big_mem() functions > > > > > and use kvzalloc/kvfree instead. > > > > > > > > Sensible, thanks. > > > > > > > > > diff --git a/drivers/scsi/cxgbi/libcxgbi.c b/drivers/scsi/cxgbi/libcxgbi.c > > > > [] > > > > > @@ -77,9 +77,9 @@ int cxgbi_device_portmap_create(struct cxgbi_device *cdev, unsigned int base, > > > > > { > > > > > struct cxgbi_ports_map *pmap = &cdev->pmap; > > > > > > > > > > - pmap->port_csk = cxgbi_alloc_big_mem(max_conn * > > > > > - sizeof(struct cxgbi_sock *), > > > > > - GFP_KERNEL); > > > > > + pmap->port_csk = kvzalloc(array_size(max_conn, > > > > > + sizeof(struct cxgbi_sock *)), > > > > > + GFP_KERNEL); > > > > > > > > missing __GFP_NOWARN > > > > > > > > > > kvmalloc_node adds __GFP_NOWARN internally to kmalloc call > > > https://elixir.bootlin.com/linux/v5.8-rc4/source/mm/util.c#L568 > > > > Only when there's a fallback, and the fallback does not. > Sorry, Joe, I don't understand why do we need to add __GFP_NOWARN here. Hi. The reason to add __GFP_NOWARN is so you don't get a dump_stack() as there's an existing error message output below this when OOM. You should either remove the error message as it just effectively duplicates the dump_stack or add __GFP_NOWARN. Your choice. cheers, Joe