Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752818AbbGQTXt (ORCPT ); Fri, 17 Jul 2015 15:23:49 -0400 Received: from mga01.intel.com ([192.55.52.88]:19569 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751725AbbGQTXr convert rfc822-to-8bit (ORCPT ); Fri, 17 Jul 2015 15:23:47 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,497,1432623600"; d="scan'208";a="608260169" From: "Odzioba, Lukasz" To: Guenter Roeck , Jean Delvare CC: "Yu, Fenghua" , "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 Thread-Topic: [PATCH] hwmon: coretemp: use list instead of fixed size array for temp data Thread-Index: AQHQvxgEYODiPG1VaU2e2NNrUiUAmJ3c9ZYAgADv3yCAAe47gIAAE0sg////U4CAACbYwA== Date: Fri, 17 Jul 2015 19:23:44 +0000 Message-ID: References: <1436976253-4810-1-git-send-email-lukasz.odzioba@intel.com> <20150715230734.76347af2@endymion.delvare> <55A93365.4000702@roeck-us.net> <55A94303.5040805@roeck-us.net> In-Reply-To: <55A94303.5040805@roeck-us.net> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [163.33.239.181] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2218 Lines: 48 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 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. > "yet" is a key term here. Presumably you have insider information. No I don't have such information. > Unless you can share this information, I don't see the point of replacing > an O(1) algorithm with O(n), especially since there is a relatively simple > alternative available to support more CPUs. Ok I understand that, and somewhat agree with that. > Unless you clarify that Intel will introduce CPU IDs which cannot be used > as array index because they are too sparse, I don't really see how the list > solution would consume less memory than an array of pointers, even if the > array is somewhat sparse. After all, a list consumes at least two pointers > per entry. Ok maybe I should state that clearer, my bad. For my purposes removing limit of supported cores or bumping it is all I need. Removing limit of maxid is just nice to have - nothing really practical any soon I guess. I based this patch on Kirill's which used lists and then you guys did not say that this is a bad idea, so I tried to solve problems reported earlier - deadlocks and race conditions and submitted another version. Maybe if I would start from scratch I would not ran into all this. In general it is good that you found the weak point of it. Thanks, Lukas -- 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/