Received: by 2002:a05:6a10:6006:0:0:0:0 with SMTP id w6csp511310pxa; Thu, 27 Aug 2020 08:16:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx8RftmHrqi82vg+exp1aWcSlVOsk7X8dqbyw6nwyw0eeHZscoZ0U9qW0Lf7gs/NMRGuJ3X X-Received: by 2002:a17:906:691:: with SMTP id u17mr20154049ejb.441.1598541403532; Thu, 27 Aug 2020 08:16:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598541403; cv=none; d=google.com; s=arc-20160816; b=COdKjfs2osk3WMlRqJCSeOgzP2cXS03AAYr/Xtv43q7L5TRtF9jq7pfQNodtN0KKuF ilIZ6B5f//5P+8OKmcV5CPZO4HJLI2Fa/jtQ2R6oNFNztKdJICe8H3VnXnU+yoo92oqh asBabFPRAD+9cIs+JQgoOnOd1Jv8b56KUMmpmnsmByOdTCoK6hk6z1SjGMgFdAZQDBJX fPHqjvOcZEsVcq+HD8BCf7xx8NsWVPbwcqt9j5OCuJJctNmeXBjNXkrKPz4quj6Oon8v 9gmjFZb5JuvyX9VWs9BaOV2NC//p0VgGqGkVhSV34uKNtSA/osAUcGCctYA4YH6CC9zs F9zQ== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:from:references:cc:to:subject; bh=MEWPiw5piojwJx0HXGqMChFUJz2WVZKjHfpQDVb1WDo=; b=bivdmxoXapBJeLcoFwcfUgKOZG1CaKSvy2kEEtq0ZzyI25nJFoU/Hv4QGD0preH/yU hD+mSrbOyin7NjG8/jVa8MDx67F/1XyjULV19xrSfGZATbrda3EM8BW3of2omycay6tA PHTKYQusHf1h+20pXaHkqnHSMc2MgAy+hiQ1aBERJnUZ5xfZLo/niQfBYmMPUX+uQAhv 2WFrz6UkUECSJoOr6RvosyrA52Pq/J9h2mGcEHwgcO/3+6fRRbSf9/+QDrIUn8anQ4kN wnbeMrtZvFNTM78o7HJnXIqf2Lbk/X8+n0zL/n3c8dNpqjbfQMMYNNy0JCXuqwUZMJdX 3WZg== 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 z22si1516484ejc.596.2020.08.27.08.16.20; Thu, 27 Aug 2020 08:16:43 -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 S1726087AbgH0PNp (ORCPT + 99 others); Thu, 27 Aug 2020 11:13:45 -0400 Received: from mail-lj1-f193.google.com ([209.85.208.193]:34292 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728113AbgH0PNT (ORCPT ); Thu, 27 Aug 2020 11:13:19 -0400 Received: by mail-lj1-f193.google.com with SMTP id y2so6860178ljc.1; Thu, 27 Aug 2020 08:13:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=MEWPiw5piojwJx0HXGqMChFUJz2WVZKjHfpQDVb1WDo=; b=pV9IToRuYwYVD0Z5AMTEUTuwrqVy2BQbX+AYMU9RiBLt204l5WuHq68pek+0ml/+9b MoP+039T6hfhxXLiPsNAmsFtlm6GlwamoTqkILUL5+CNDmUaYVxRDqU/86Rm8jcEDSD+ z/Vg9EFrDiyrajELwPlUJYUgkuG6kfk825c/PlzoJ0dn7uRJAxRLrVAHe35Sp3vynemf oCWxT1evvg7S+LcUbQcKDgSfgg7ZtMOoZxyHsUahU0S9msgsl8B2ZO4Ii3OLg9K6QTgF JTg8U4PDugAexzu4Idfy75PlOElxznWW5H4NCTzrB4iuuxXWdEidNq+0mWm2mVdDiQpd botQ== X-Gm-Message-State: AOAM530Ss32d7/7z557qqQSiMR/DHRKM3PLkVP/UBdoDFC1Ih967foYi H3oQbeKlZGBCs1y/9L9bOadxQNVAJL4= X-Received: by 2002:a2e:9d8e:: with SMTP id c14mr10426635ljj.332.1598541196060; Thu, 27 Aug 2020 08:13:16 -0700 (PDT) Received: from [192.168.1.8] ([213.87.147.111]) by smtp.gmail.com with ESMTPSA id d10sm530058ljg.87.2020.08.27.08.13.14 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 27 Aug 2020 08:13:15 -0700 (PDT) Subject: Re: [PATCH v2] scsi: libcxgbi: use kvzalloc instead of opencoded kzalloc/vzalloc To: "Martin K. Petersen" , "James E.J. Bottomley" Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Joe Perches References: <20200731215524.14295-1-efremov@linux.com> <20200801133123.61834-1-efremov@linux.com> From: Denis Efremov Autocrypt: addr=efremov@linux.com; keydata= mQINBFsJUXwBEADDnzbOGE/X5ZdHqpK/kNmR7AY39b/rR+2Wm/VbQHV+jpGk8ZL07iOWnVe1 ZInSp3Ze+scB4ZK+y48z0YDvKUU3L85Nb31UASB2bgWIV+8tmW4kV8a2PosqIc4wp4/Qa2A/ Ip6q+bWurxOOjyJkfzt51p6Th4FTUsuoxINKRMjHrs/0y5oEc7Wt/1qk2ljmnSocg3fMxo8+ y6IxmXt5tYvt+FfBqx/1XwXuOSd0WOku+/jscYmBPwyrLdk/pMSnnld6a2Fp1zxWIKz+4VJm QEIlCTe5SO3h5sozpXeWS916VwwCuf8oov6706yC4MlmAqsQpBdoihQEA7zg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SyzxgONmHAroFcqCFUlfAqUDO T30gV5bQ8BHqvfWyEhJT+CS3JJyP8BmmSgPa0Adlp6Do+pRsOO1YNNO78SYABhMi3fEa7X37 WxL31TrNCPnIauTgZtf/KCFQJpKaakC3ffEkPhyTjEl7oOE9xccNjccZraadi+2uHV0ULA1m ycHhb817A03n1I00QwLf2wOkckdqTqRbFFI/ik69hF9hemK/BmAHpShI+z1JsYT9cSs8D7wb aF/jQVy4URensgAPkgXsRiboqOj/rTz9F5mpd/gPU/IOUPFEMoo4TInt/+dEVECHioU3RRrW EahrGMfRngbdp/mKs9aBR56ECMfFFUPyI3VJsNbgpcIJjV/0N+JdJKQpJ/4uQ2zNm0wH/RU8 CRJvEwtKemX6fp/zLI36Gvz8zJIjSBIEqCb7vdgvWarksrhmi6/Jay5zRZ03+k6YwiqgX8t7 ANwvYa1h1dQ36OiTqm1cIxRCGl4wrypOVGx3OjCar7sBLD+NkwO4RaqFvdv0xuuy4x01VnOF Message-ID: Date: Thu, 27 Aug 2020 18:13:13 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 MIME-Version: 1.0 In-Reply-To: <20200801133123.61834-1-efremov@linux.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Ping? On 8/1/20 4:31 PM, Denis Efremov wrote: > Remove cxgbi_alloc_big_mem(), cxgbi_free_big_mem() functions > and use kvzalloc/kvfree instead. __GFP_NOWARN added to kvzalloc() > call because we already print a warning in case of allocation fail. > > Signed-off-by: Denis Efremov > --- > drivers/scsi/cxgbi/libcxgbi.c | 8 ++++---- > drivers/scsi/cxgbi/libcxgbi.h | 16 ---------------- > 2 files changed, 4 insertions(+), 20 deletions(-) > > diff --git a/drivers/scsi/cxgbi/libcxgbi.c b/drivers/scsi/cxgbi/libcxgbi.c > index 4bc794d2f51c..51f4d34da73f 100644 > --- 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 | __GFP_NOWARN); > if (!pmap->port_csk) { > pr_warn("cdev 0x%p, portmap OOM %u.\n", cdev, max_conn); > return -ENOMEM; > @@ -124,7 +124,7 @@ static inline void cxgbi_device_destroy(struct cxgbi_device *cdev) > if (cdev->cdev2ppm) > cxgbi_ppm_release(cdev->cdev2ppm(cdev)); > if (cdev->pmap.max_connect) > - cxgbi_free_big_mem(cdev->pmap.port_csk); > + kvfree(cdev->pmap.port_csk); > kfree(cdev); > } > > diff --git a/drivers/scsi/cxgbi/libcxgbi.h b/drivers/scsi/cxgbi/libcxgbi.h > index 84b96af52655..321426242be4 100644 > --- a/drivers/scsi/cxgbi/libcxgbi.h > +++ b/drivers/scsi/cxgbi/libcxgbi.h > @@ -537,22 +537,6 @@ struct cxgbi_task_data { > #define iscsi_task_cxgbi_data(task) \ > ((task)->dd_data + sizeof(struct iscsi_tcp_task)) > > -static inline void *cxgbi_alloc_big_mem(unsigned int size, > - gfp_t gfp) > -{ > - void *p = kzalloc(size, gfp | __GFP_NOWARN); > - > - if (!p) > - p = vzalloc(size); > - > - return p; > -} > - > -static inline void cxgbi_free_big_mem(void *addr) > -{ > - kvfree(addr); > -} > - > static inline void cxgbi_set_iscsi_ipv4(struct cxgbi_hba *chba, __be32 ipaddr) > { > if (chba->cdev->flags & CXGBI_FLAG_IPV4_SET) >