From: "Odzioba, Lukasz" <lukasz.odzioba@intel.com>
To: Guenter Roeck <linux@roeck-us.net>, Jean Delvare <jdelvare@suse.de>
Cc: "Yu, Fenghua" <fenghua.yu@intel.com>,
"lm-sensors@lm-sensors.org" <lm-sensors@lm-sensors.org>,
"linux-kernel@vger.kernel.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 17:28:20 +0000 [thread overview]
Message-ID: <D6EDEBF1F91015459DB866AC4EE162CCF76BDA@IRSMSX103.ger.corp.intel.com> (raw)
In-Reply-To: <55A93365.4000702@roeck-us.net>
From: Guenter Roeck [mailto:linux@roeck-us.net]
On Friday, July 17, 2015 6:55 PM Guenter Roeck wrote:
> You don't really explain why your approach would be better than
> allocating an array of pointers to struct temp_data and increasing
> its size using krealloc if needed.
Let's consider two cases of such implementation:
a) we use array of pointers with O(n) access algorithm
b) we use array of pointers with O(1) access algorithm
In both cases an array will have greater memory footprint unless
we implement reallocation ourselves when cpus are disabled which will
make code harder to maintain.
Case b) does not handle huge core ids and sparse enumeration well -
it is still to discuss whether we really need it since there is no
such hardware yet.
I am not saying that my solution is the best of possible ones.
I am saying that "the best" can vary depending on which criteria do you
choose from (time, memory, clean code...). Some may say that O(n) is
fine unless we have thousands of cores and this code is not on hot path,
others may be concerned more about memory on small/old devices.
I don't see holy grail here, If you see one please let me know.
If you think that we don't have to care so much about memory,
then I can create another patch which uses array instead of list.
Thanks,
Lukas
next prev parent reply other threads:[~2015-07-17 17:28 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 [this message]
2015-07-17 18:01 ` Guenter Roeck
2015-07-17 19:23 ` Odzioba, Lukasz
2015-07-17 21:33 ` Jean Delvare
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=D6EDEBF1F91015459DB866AC4EE162CCF76BDA@IRSMSX103.ger.corp.intel.com \
--to=lukasz.odzioba@intel.com \
--cc=fenghua.yu@intel.com \
--cc=jdelvare@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=lm-sensors@lm-sensors.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
all inboxes | Powered by JetHome®