Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1185046 > unrolled thread
| Started by | Jean Delvare <jdelvare@suse.de> |
|---|---|
| First post | 2015-07-15 23:10 +0200 |
| Last post | 2015-07-17 23:40 +0200 |
| Articles | 3 — 1 participant |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
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
| From | Jean Delvare <jdelvare@suse.de> |
|---|---|
| Date | 2015-07-15 23:10 +0200 |
| Subject | Re: [PATCH] hwmon: coretemp: use list instead of fixed size array for temp data |
| Message-ID | <pMC6d-2IR-7@gated-at.bofh.it> |
On Wed, 15 Jul 2015 18:04:13 +0200, Lukasz Odzioba wrote: > Removes the limits of supported CPU cores and max core ID. I see the benefit of removing the arbitrary limit, but why use a list instead of a dynamically allocated array? This is turning a O(1) algorithm into a O(n) algorithm. I know n isn't too large in this case but I still consider it bad practice if it can be avoided. Do you expect core IDs to become arbitrarily large? Significantly larger than the core count? You need a better patch description for sure. Saying what the patch does isn't sufficient, you need to explain why this is needed and why this is the right way to do it. -- 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/
[toc] | [next] | [standalone]
| From | Jean Delvare <jdelvare@suse.de> |
|---|---|
| Date | 2015-07-17 23:30 +0200 |
| Message-ID | <pNlmG-yp-1@gated-at.bofh.it> |
| In reply to | #1185046 |
On Fri, 17 Jul 2015 12:36:34 -0700, Guenter Roeck wrote: > Hi Jean, > > On 07/17/2015 12:11 PM, Jean Delvare wrote: > > > > > We could just drop NUM_REAL_CORES and use CONFIG_NR_CPUS instead, I > > would be fine with that. This lets people worried about memory > > consumption control it. > > Unfortunately this won't work because the CPU ID is non-linear; > an 8-core system may have a CPU ID larger than 7. Oh right, I forgot about that. Brilliant hardware/firmware engineers... Well that does not prevent us from using CONFIG_NR_CPUS, "just" the code would need to be modified to remove the assumption that the array index matches the logical CPU ID. BTW I wonder how the rest of the kernel handles the situation. CONFIG_NR_CPUS is used where relevant so there certainly _is_ a linear numbering which is independent from the CPU ID. -- 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/
[toc] | [prev] | [next] | [standalone]
| From | Jean Delvare <jdelvare@suse.de> |
|---|---|
| Date | 2015-07-17 23:40 +0200 |
| Message-ID | <pNlwm-JB-15@gated-at.bofh.it> |
| In reply to | #1185046 |
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/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web