linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Mark Brown <broonie@kernel.org>,
	linux-spi <linux-spi@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 2/3] spi: allocate spi_board_info entries one by one
Date: Tue, 28 Feb 2017 14:12:45 -0800	[thread overview]
Message-ID: <20170228221245.GL20776@dtor-ws> (raw)
In-Reply-To: <CAMuHMdVTxDLnnVE0S7VfGKNB1EPnKv_7B8rgA2c+Ub7KgZHn1A@mail.gmail.com>

On Tue, Feb 28, 2017 at 09:15:12PM +0100, Geert Uytterhoeven wrote:
> On Tue, Feb 28, 2017 at 7:54 PM, Mark Brown <broonie@kernel.org> wrote:
> > On Tue, Feb 28, 2017 at 10:24:17AM -0800, Dmitry Torokhov wrote:
> >> On Tue, Feb 28, 2017 at 09:16:50AM +0000, Mark Brown wrote:
> >> > On Mon, Feb 27, 2017 at 08:18:56PM -0800, Dmitry Torokhov wrote:
> >> > > Lists of spi_board_info entries registered with spi_register_board_info()
> >> > > can be quite long; instead of forcing memory allocator find contagious
> >
> >> > Do you have numbers on that?
> >
> >> Hm, so the largest array seems to be in
> >> arch/blackfin/mach-bf537/boards/stamp.c at max of 43 entries. The new
> >> board info is ether 60 or 72 bytes, so we get 2 or 3K table. Not above
> >> page, but still could be packed I think.
> >
> > Oh wow, that's impressively large.  Still not sure the optimization is
> > particularly worth it though, it's small change in the grand scheme of
> > things.  OTOH it's a small change.
> 
> Given this is done during early boot, what's the probability of not having
> sufficient contiguous memory?
> 
> >> If we decide that we want to keep single chunk I'll just change the
> >> allocation to kcalloc. Let me know.
> >
> > I'd be inclined to do that because it requires less thinking about the
> > value of what should be a very small optimization either way but
> > whatever :)
> 
> Tada...
> 
> commit f9bdb7fdd2cac17bdc9c344b6036e6939fa087cd
> Author: Markus Elfring <elfring@users.sourceforge.net>
> Date:   Fri Jan 13 12:28:04 2017 +0100
> 
>     spi: Use kcalloc() in spi_register_board_info()

Or even kmalloc_array() as zeroing out memory is not needed. But I'll
let Mark sort it out and drop my patch #2.

Thanks.

-- 
Dmitry

  reply	other threads:[~2017-02-28 22:12 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-28  4:18 [PATCH v2 0/3] Allow specifying properties with spi_register_board_info Dmitry Torokhov
2017-02-28  4:18 ` [PATCH v2 1/3] spi: allow attaching device properties to SPI board info Dmitry Torokhov
2017-02-28  4:18 ` [PATCH v2 2/3] spi: allocate spi_board_info entries one by one Dmitry Torokhov
     [not found]   ` <20170228041857.13292-3-dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-02-28  9:16     ` Mark Brown
     [not found]       ` <20170228091650.eiypppxblfhh33pb-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2017-02-28 18:24         ` Dmitry Torokhov
2017-02-28 18:54           ` Mark Brown
     [not found]             ` <20170228185455.mdmvuc232chlveve-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2017-02-28 20:15               ` Geert Uytterhoeven
2017-02-28 22:12                 ` Dmitry Torokhov [this message]
2017-02-28 20:52             ` Lars-Peter Clausen
2017-02-28  4:18 ` [PATCH v2 3/3] spi: allow registering empty spi_board_info lists Dmitry Torokhov
     [not found]   ` <20170228041857.13292-4-dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-02-28 14:01     ` Andy Shevchenko
2017-02-28 18:26       ` Dmitry Torokhov

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=20170228221245.GL20776@dtor-ws \
    --to=dmitry.torokhov@gmail.com \
    --cc=broonie@kernel.org \
    --cc=geert@linux-m68k.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).