Re: [PATCH 1/5] x86: Change size of node ids from u8 to u16 fixup

From: Mike Travis
Date: Sat Jan 19 2008 - 16:25:49 EST


David Rientjes wrote:
> On Fri, 18 Jan 2008, Yinghai Lu wrote:
>
>>> +#if MAX_NUMNODES > 256
>>> +typedef u16 numanode_t;
>>> +#else
>>> +typedef u8 numanode_t;
>>> +#endif
>>> +
>>> #endif /* _LINUX_NUMA_H */
>> that is wrong, you can not change pxm_to_node_map from int to u8 or u16.
>>

Thanks for finding this!

>
> Yeah, NID_INVAL is negative so no unsigned type will work here,
> unfortunately. And that reduces the intended savings of your change since
> the smaller type can only be used with a smaller CONFIG_NODES_SHIFT.
>

Excuse my ignorance but why wouldn't this work:

static numanode_t pxm_to_node_map[MAX_PXM_DOMAINS]
= { [0 ... MAX_PXM_DOMAINS - 1] = NUMA_NO_NODE };
...
>> int acpi_map_pxm_to_node(int pxm)
>> {
> int node = pxm_to_node_map[pxm];
>
> if (node < 0)

numanode_t node = pxm_to_node_map[pxm];

if (node != NUMA_NO_NODE) {
>> if (nodes_weight(nodes_found_map) >= MAX_NUMNODES)
>> return NID_INVAL;
>> node = first_unset_node(nodes_found_map);
>> __acpi_map_pxm_to_node(pxm, node);
>> node_set(node, nodes_found_map);
>> }

or change:
#define NID_INVAL (-1)
to
#define NID_INVAL ((numanode_t)(-1))
...
if (node != NID_INVAL) {
>> if (nodes_weight(nodes_found_map) >= MAX_NUMNODES)
>> return NID_INVAL;
>> node = first_unset_node(nodes_found_map);
>> __acpi_map_pxm_to_node(pxm, node);
>> node_set(node, nodes_found_map);
>> }

Though why there two "node invalid" values I'm not sure... ?

>>
>> return node;
>> }

And btw, shouldn't the pxm value be sized to numanode_t size as well?
Will it ever be larger than the largest node id?

Thanks,
Mike
--
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/