Re: [PATCH] Reading deterministic cache parameters and exporting itin /sysfs
From: Andrew Morton
Date: Wed Mar 16 2005 - 02:08:53 EST
Venkatesh Pallipadi <venkatesh.pallipadi@xxxxxxxxx> wrote:
>
> The attached patch adds support for using cpuid(4) instead of cpuid(2), to get
> CPU cache information in a deterministic way for Intel CPUs, whenever
> supported.
- find_num_cache_leaves can be marked __init
- Please look for other __init opportunities. That's quite a lot of code.
- Some functions have a space before the ( and some don't:
+static ssize_t show_size (struct _cpuid4_info *this_leaf, char *buf)
omitting the space is preferred.
- Don't cast the return value of kmalloc:
+ cpuid4_info[cpu] = (struct _cpuid4_info *)kmalloc(
+ sizeof(struct _cpuid4_info) * num_cache_leaves, GFP_KERNEL);
- Sometimes there's a space after an `if', sometimes not.
+ if(cpuid4_info[i])
a space is preferred.
- kfree(NULL) is permitted:
+ if(cpuid4_info[i])
+ kfree(cpuid4_info[i]);
+ if(cache_kobject[i])
+ kfree(cache_kobject[i]);
+ if(index_kobject[i])
+ kfree(index_kobject[i]);
(in several places)
Once you've worked through the design issues with davej, please upissue the
patch, thanks.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/