linux 2.6.16.38 w/ vs2.0.3-rc1
[linux-2.6.git] / arch / ia64 / sn / kernel / sn2 / sn_hwperf.c
index 739c948..70db21f 100644 (file)
@@ -110,11 +110,7 @@ static int sn_hwperf_geoid_to_cnode(char *location)
        if (sn_hwperf_location_to_bpos(location, &rack, &bay, &slot, &slab))
                return -1;
 
-       /*
-        * FIXME: replace with cleaner for_each_XXX macro which addresses
-        * both compute and IO nodes once ACPI3.0 is available.
-        */
-       for (cnode = 0; cnode < num_cnodes; cnode++) {
+       for_each_node(cnode) {
                geoid = cnodeid_get_geoid(cnode);
                module_id = geo_module(geoid);
                this_rack = MODULE_GET_RACK(module_id);
@@ -284,8 +280,6 @@ static int sn_hwperf_get_nearest_node_objdata(struct sn_hwperf_object_info *objb
        /* find nearest node with cpus and nearest memory */
        for (router=NULL, j=0; j < op->ports; j++) {
                dest = sn_hwperf_findobj_id(objbuf, nobj, ptdata[j].conn_id);
-               if (dest && SN_HWPERF_IS_ROUTER(dest))
-                       router = dest;
                if (!dest || SN_HWPERF_FOREIGN(dest) ||
                    !SN_HWPERF_IS_NODE(dest) || SN_HWPERF_IS_IONODE(dest)) {
                        continue;
@@ -301,6 +295,8 @@ static int sn_hwperf_get_nearest_node_objdata(struct sn_hwperf_object_info *objb
                                *near_mem_node = c;
                        found_mem++;
                }
+               if (SN_HWPERF_IS_ROUTER(dest))
+                       router = dest;
        }
 
        if (router && (!found_cpu || !found_mem)) {
@@ -493,7 +489,7 @@ static int sn_topology_show(struct seq_file *s, void *d)
                 * numalink ports
                 */
                sz = obj->ports * sizeof(struct sn_hwperf_port_info);
-               if ((ptdata = kmalloc(sz, GFP_KERNEL)) == NULL)
+               if ((ptdata = vmalloc(sz)) == NULL)
                        return -ENOMEM;
                e = ia64_sn_hwperf_op(sn_hwperf_master_nasid,
                                      SN_HWPERF_ENUM_PORTS, obj->id, sz,
@@ -541,7 +537,7 @@ static int sn_topology_show(struct seq_file *s, void *d)
                                (SN_HWPERF_IS_NL3ROUTER(obj) ||
                                SN_HWPERF_IS_NL3ROUTER(p)) ?  "LLP3" : "LLP4");
                }
-               kfree(ptdata);
+               vfree(ptdata);
        }
 
        return 0;
@@ -609,7 +605,7 @@ static int sn_hwperf_op_cpu(struct sn_hwperf_op_info *op_info)
        op_info->a->arg &= SN_HWPERF_ARG_OBJID_MASK;
 
        if (cpu != SN_HWPERF_ARG_ANY_CPU) {
-               if (cpu >= NR_CPUS || !cpu_online(cpu)) {
+               if (cpu >= num_online_cpus() || !cpu_online(cpu)) {
                        r = -EINVAL;
                        goto out;
                }