mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jean Delvare <jdelvare@suse.de>
To: "Odzioba, Lukasz" <lukasz.odzioba@intel.com>
Cc: Guenter Roeck <linux@roeck-us.net>,
	"Yu, Fenghua" <fenghua.yu@intel.com>,
	lm-sensors@lm-sensors.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] hwmon: coretemp: use list instead of fixed size array for temp data
Date: Fri, 17 Jul 2015 23:33:38 +0200	[thread overview]
Message-ID: <20150717233338.0ae52805@endymion.delvare> (raw)
In-Reply-To: <D6EDEBF1F91015459DB866AC4EE162CCF76C3A@IRSMSX103.ger.corp.intel.com>

Hi Lukasz,

On Fri, 17 Jul 2015 19:23:44 +0000, Odzioba, Lukasz wrote:
> On Friday, July 17, 2015 8:02 PM Guenter Roeck wrote:
> > Please explain why krealloc() won't work, why using krealloc(() would
> > result in a larger memory footprint than using lists, and why disabling
> > CPUs would require any action in the first place.
> 
> It will work, but it can use more memory for cpus with many cores.
> If you have just one core visible to the kernel with id 59 
> (i.e. the rest are disabled by hardware) out of 60-core cpu then you
> have to allocate an array of 60 pointers instead of just one element of

Arrays of pointers are cheap. You can fit 512 pointers in a single
memory page.

> the list. Of course you can say that for cpu with just one core list will
> use 3x the memory needed by array and that's true. I see no point in 
> arguing which case is more important, let's move on.

I see the point in arguing: the example above is just silly and does
not match any real-world application. Nobody buys a 60-core CPU to run
it with a single core enabled.

When you have two or more alternative implementations possible,
thinking in terms of the most common cases is a key to make the right
decision. Thinking about servers with a lots of CPU cores versus
embedded devices with few cores and tight memory constraints, that is
useful. Making up corner cases is not.

-- 
Jean Delvare
SUSE L3 Support

  reply	other threads:[~2015-07-17 21:33 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-15 16:04 Lukasz Odzioba
2015-07-15 21:07 ` Jean Delvare
2015-07-16 13:17   ` Odzioba, Lukasz
2015-07-17 16:55     ` Guenter Roeck
2015-07-17 17:28       ` Odzioba, Lukasz
2015-07-17 18:01         ` Guenter Roeck
2015-07-17 19:23           ` Odzioba, Lukasz
2015-07-17 21:33             ` Jean Delvare [this message]
2015-07-17 19:11         ` Jean Delvare
2015-07-17 19:36           ` Guenter Roeck
2015-07-17 21:25             ` Jean Delvare
  -- strict thread matches above, loose matches on Subject: below --
2012-05-01 21:25 [PATCH] hwmon: coretemp: fix oops on cpu unplug Guenter Roeck
2012-05-02 15:10 ` [PATCH] hwmon: coretemp: use list instead of fixed size array for temp data Kirill A. Shutemov

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=20150717233338.0ae52805@endymion.delvare \
    --to=jdelvare@suse.de \
    --cc=fenghua.yu@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=lm-sensors@lm-sensors.org \
    --cc=lukasz.odzioba@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®