Received: by 10.213.65.68 with SMTP id h4csp2120561imn; Thu, 5 Apr 2018 09:17:48 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/ten/mREvjpJY6IDhZlFz/fEzPTtOWWraoMmVjXU2V55zXyrXcjTpmbMGGYjmBbMzcdVOO X-Received: by 10.98.153.204 with SMTP id t73mr17667298pfk.121.1522945067946; Thu, 05 Apr 2018 09:17:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522945067; cv=none; d=google.com; s=arc-20160816; b=CsAF/RogNA9/hJj2wRIsi4BKjaOEhcDSI9rMlhj4ZM3y4B2UiuuR6eTd9BTdQqT4We 3as/E1Bge9AadWFm7NsET3msuyOONjBlG/guu/J+KNtvLPPJ3u1+iU80sYJEQfFBNN0x ZNR1XRpXphs6ySaXFm049Uiawy50Kd0apwpBxnYq8Fyl8rRLpNJDRfOtIrHSyWw9VQw9 kTx6tvFVme4d1tZYvCa10gGdSM4GHqcic8fEFL/Ux+bwDrFSpc8S8wPLWX0gQs/DFK/7 fmQf5Gt3v0uiDyw62Q5xKSNyv+Xaql6EaVJ7mpH5DCCZk56l9brNlmruTFGvNzKOD5EY IgpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=ESdGdc6Tt4sr/ABv/G57ocbUBjBJEwhoz8PQMge3srQ=; b=mLEKSTnpNFhNGJy8OSMvDjpe2n1FkIa/U+zCzIgiMu+VA2qntwSh1L/0JL80n/ylew SmfUoLCv4rJ9ZEYru4aUuvzgnRE98Sk7G6TX2EUQMlzx3m+08pKK0hd2EQu6Z66Mmr4+ 0z1RoCtlqDWF2ixeNrb9+sj5oMyNRD3Dv9K+Q/tPM/SB1S/kyCqyPYfd5hvTvWAfkua6 JjaTi7KRmpwJS/5qizJ1OyfEfJBD9mPixOs1IrF+ipCRmuFlMKjt/xHk3JkkJ0Ap043Q yAilkv4DgGD3eVQAFVbYnaBWpugRPBqIRS/TlfEeMkuSZUlyis/u4fmNASfSqwk04aj5 ew/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=vD1t20yO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d37-v6si6047076plb.566.2018.04.05.09.17.33; Thu, 05 Apr 2018 09:17:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=vD1t20yO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751494AbeDEQPk (ORCPT + 99 others); Thu, 5 Apr 2018 12:15:40 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:36320 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751179AbeDEQPi (ORCPT ); Thu, 5 Apr 2018 12:15:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=ESdGdc6Tt4sr/ABv/G57ocbUBjBJEwhoz8PQMge3srQ=; b=vD1t20yOS2gK/gZCiCgwicp1J H6F/9YAtY3sy1hBJCVvcOrZ1tNDm0gzQfjfrGT/EL4EsIkOxFN6V7ERP2ECKKEBeQ9dMp4zhZj+ZL 8a+r7cFHS7vrSEx89AjDcfousb/e6eDFRit6u3lAMJyvIST7cF7nD6sXxdy81aljexRY44iIEgp6D QO006CppfiTezOsCHMfIeic9gJ3ZAJTLErrHYOaK+Imfv5toCgBR4JVpNms5+QQ1BJ2puKFzdKORH Bsk0gsvVsm25ojcC2oIWTHp+SPgcmhgqxKja6s551Lf0cx+02tkjJA+5/OJMKuNJnwaWVLsDoVxx5 NYt8QB2Vg==; Received: from hch by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1f47Xy-0001qu-BB; Thu, 05 Apr 2018 16:15:34 +0000 Date: Thu, 5 Apr 2018 09:15:34 -0700 From: Christoph Hellwig To: Vadim Lomovtsev Cc: Christoph Hellwig , sgoutham@cavium.com, sunil.kovvuri@gmail.com, rric@kernel.org, linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, davem@davemloft.net, dnelson@redhat.com, gustavo@embeddedor.com, Vadim Lomovtsev Subject: Re: [PATCH] net: thunderx: rework mac addresses list to u64 array Message-ID: <20180405161534.GA18042@infradead.org> References: <20180405145756.12633-1-Vadim.Lomovtsev@caviumnetworks.com> <20180405150748.GA5716@infradead.org> <20180405160749.GB12703@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180405160749.GB12703@localhost.localdomain> User-Agent: Mutt/1.9.2 (2017-12-15) X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 05, 2018 at 09:07:49AM -0700, Vadim Lomovtsev wrote: > > > > > + mc_list = kmalloc(sizeof(*mc_list) + > > > + sizeof(u64) * netdev_mc_count(netdev), > > > + GFP_ATOMIC); > > > > kmalloc_array(), please. > > In this case it would require two memory allocation calls to kmalloc() for > xcast_addr_list struct and to kmalloc_array() for 'mc' addresses, becasue of > different data types and so two null-ptr checks .. this is what I'd like get rid off. > > My idea of this was to keep number of array elements and themselves within the > same memory block/page to reduce number of memory allocation requests, number > of allocated pages/blocks and avoid possible memory fragmentation (however, I believe > the latter is already handled at the mm layer). Indeed, lets keep it as-is.