All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Vadim Lomovtsev <Vadim.Lomovtsev@caviumnetworks.com>
Cc: Christoph Hellwig <hch@infradead.org>,
	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 <Vadim.Lomovtsev@cavium.com>
Subject: Re: [PATCH] net: thunderx: rework mac addresses list to u64 array
Date: Thu, 5 Apr 2018 09:15:34 -0700	[thread overview]
Message-ID: <20180405161534.GA18042@infradead.org> (raw)
In-Reply-To: <20180405160749.GB12703@localhost.localdomain>

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.

WARNING: multiple messages have this Message-ID (diff)
From: hch@infradead.org (Christoph Hellwig)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] net: thunderx: rework mac addresses list to u64 array
Date: Thu, 5 Apr 2018 09:15:34 -0700	[thread overview]
Message-ID: <20180405161534.GA18042@infradead.org> (raw)
In-Reply-To: <20180405160749.GB12703@localhost.localdomain>

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.

  reply	other threads:[~2018-04-05 16:15 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-05 14:57 [PATCH] net: thunderx: rework mac addresses list to u64 array Vadim Lomovtsev
2018-04-05 14:57 ` Vadim Lomovtsev
2018-04-05 15:00 ` Vadim Lomovtsev
2018-04-05 15:00   ` Vadim Lomovtsev
2018-04-05 15:07 ` Christoph Hellwig
2018-04-05 15:07   ` Christoph Hellwig
2018-04-05 16:07   ` Vadim Lomovtsev
2018-04-05 16:07     ` Vadim Lomovtsev
2018-04-05 16:15     ` Christoph Hellwig [this message]
2018-04-05 16:15       ` Christoph Hellwig
2018-04-06 11:14 ` [PATCH v2] " Vadim Lomovtsev
2018-04-06 11:14   ` Vadim Lomovtsev
2018-04-06 11:36   ` Gustavo A. R. Silva
2018-04-06 11:36     ` Gustavo A. R. Silva
2018-04-06 11:43     ` Vadim Lomovtsev
2018-04-06 11:43       ` Vadim Lomovtsev
2018-04-06 11:47       ` Gustavo A. R. Silva
2018-04-06 11:47         ` Gustavo A. R. Silva
2018-04-06 11:53         ` Vadim Lomovtsev
2018-04-06 11:53           ` Vadim Lomovtsev
2018-04-06 11:48   ` Robin Murphy
2018-04-06 11:48     ` Robin Murphy
2018-04-06 12:07     ` Vadim Lomovtsev
2018-04-06 12:07       ` Vadim Lomovtsev
2018-04-06 14:04   ` [PATCH v3] " Vadim Lomovtsev
2018-04-06 14:04     ` Vadim Lomovtsev
2018-04-06 15:16     ` Vadim Lomovtsev
2018-04-06 15:16       ` Vadim Lomovtsev
2018-04-06 19:53     ` [PATCH v4] " Vadim Lomovtsev
2018-04-06 19:53       ` Vadim Lomovtsev
2018-04-08 16:42       ` David Miller
2018-04-08 16:42         ` David Miller
2018-04-09  9:42         ` Vadim Lomovtsev
2018-04-09  9:42           ` Vadim Lomovtsev
2018-04-09 13:24       ` [PATCH v5] " Vadim Lomovtsev
2018-04-09 13:24         ` Vadim Lomovtsev
2018-04-09 15:00         ` David Miller
2018-04-09 15:00           ` David Miller
2018-04-06 15:06   ` [PATCH v2] " David Miller
2018-04-06 15:06     ` David Miller
2018-04-06 15:14     ` Vadim Lomovtsev
2018-04-06 15:14       ` Vadim Lomovtsev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180405161534.GA18042@infradead.org \
    --to=hch@infradead.org \
    --cc=Vadim.Lomovtsev@cavium.com \
    --cc=Vadim.Lomovtsev@caviumnetworks.com \
    --cc=davem@davemloft.net \
    --cc=dnelson@redhat.com \
    --cc=gustavo@embeddedor.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=rric@kernel.org \
    --cc=sgoutham@cavium.com \
    --cc=sunil.kovvuri@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.