Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1187214

Re: [PATCH] hwmon: coretemp: use list instead of fixed size array for temp data

From Jean Delvare <jdelvare@suse.de>
Newsgroups linux.kernel
Subject Re: [PATCH] hwmon: coretemp: use list instead of fixed size array for temp data
Date 2015-07-17 23:40 +0200
Message-ID <pNlwm-JB-15@gated-at.bofh.it> (permalink)
References (2 earlier) <pMReX-7Jp-37@gated-at.bofh.it> <pNh9o-2Q8-27@gated-at.bofh.it> <pNhCq-3Dd-21@gated-at.bofh.it> <pNif8-4Cp-33@gated-at.bofh.it> <pNjuy-6k7-7@gated-at.bofh.it>
Organization SUSE Linux

Show all headers | View raw


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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Re: [PATCH] hwmon: coretemp: use list instead of fixed size array  for temp data Jean Delvare <jdelvare@suse.de> - 2015-07-15 23:10 +0200
  Re: [PATCH] hwmon: coretemp: use list instead of fixed size array  for temp data Jean Delvare <jdelvare@suse.de> - 2015-07-17 23:30 +0200
  Re: [PATCH] hwmon: coretemp: use list instead of fixed size array  for temp data Jean Delvare <jdelvare@suse.de> - 2015-07-17 23:40 +0200

csiph-web