[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20150717233338.0ae52805@endymion.delvare>
Date: Fri, 17 Jul 2015 23:33:38 +0200
From: Jean Delvare <jdelvare@...e.de>
To: "Odzioba, Lukasz" <lukasz.odzioba@...el.com>
Cc: Guenter Roeck <linux@...ck-us.net>,
"Yu, Fenghua" <fenghua.yu@...el.com>, lm-sensors@...sensors.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] hwmon: coretemp: use list instead of fixed size array
for temp data
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@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists