lkml.org 
[lkml]   [2008]   [Jan]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/5] x86: Change size of node ids from u8 to u16 fixup
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


\
 
 \ /
  Last update: 2008-01-19 22:27    [W:0.275 / U:0.264 seconds]
©2003-2014 Jasper Spaans. Advertise on this site