Commit 25ba77c141dbcd2602dd0171824d0d72aa023a01

Authored by Andy Whitcroft
Committed by Linus Torvalds
1 parent bc4ba393c0

[PATCH] numa node ids are int, page_to_nid and zone_to_nid should return int

NUMA node ids are passed as either int or unsigned int almost exclusivly
page_to_nid and zone_to_nid both return unsigned long.  This is a throw
back to when page_to_nid was a #define and was thus exposing the real type
of the page flags field.

In addition to fixing up the definitions of page_to_nid and zone_to_nid I
audited the users of these functions identifying the following incorrect
uses:

1) mm/page_alloc.c show_node() -- printk dumping the node id,
2) include/asm-ia64/pgalloc.h pgtable_quicklist_free() -- comparison
   against numa_node_id() which returns an int from cpu_to_node(), and
3) mm/mpolicy.c check_pte_range -- used as an index in node_isset which
   uses bit_set which in generic code takes an int.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Cc: Christoph Lameter <clameter@engr.sgi.com>
Cc: "Luck, Tony" <tony.luck@intel.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

Showing 5 changed files with 7 additions and 7 deletions Side-by-side Diff

include/asm-ia64/pgalloc.h
... ... @@ -60,7 +60,7 @@
60 60 static inline void pgtable_quicklist_free(void *pgtable_entry)
61 61 {
62 62 #ifdef CONFIG_NUMA
63   - unsigned long nid = page_to_nid(virt_to_page(pgtable_entry));
  63 + int nid = page_to_nid(virt_to_page(pgtable_entry));
64 64  
65 65 if (unlikely(nid != numa_node_id())) {
66 66 free_page((unsigned long)pgtable_entry);
... ... @@ -456,7 +456,7 @@
456 456 return (page->flags >> ZONEID_PGSHIFT) & ZONEID_MASK;
457 457 }
458 458  
459   -static inline unsigned long zone_to_nid(struct zone *zone)
  459 +static inline int zone_to_nid(struct zone *zone)
460 460 {
461 461 #ifdef CONFIG_NUMA
462 462 return zone->node;
463 463  
... ... @@ -466,9 +466,9 @@
466 466 }
467 467  
468 468 #ifdef NODE_NOT_IN_PAGE_FLAGS
469   -extern unsigned long page_to_nid(struct page *page);
  469 +extern int page_to_nid(struct page *page);
470 470 #else
471   -static inline unsigned long page_to_nid(struct page *page)
  471 +static inline int page_to_nid(struct page *page)
472 472 {
473 473 return (page->flags >> NODES_PGSHIFT) & NODES_MASK;
474 474 }
... ... @@ -221,7 +221,7 @@
221 221 orig_pte = pte = pte_offset_map_lock(vma->vm_mm, pmd, addr, &ptl);
222 222 do {
223 223 struct page *page;
224   - unsigned int nid;
  224 + int nid;
225 225  
226 226 if (!pte_present(*pte))
227 227 continue;
... ... @@ -1407,7 +1407,7 @@
1407 1407 static inline void show_node(struct zone *zone)
1408 1408 {
1409 1409 if (NUMA_BUILD)
1410   - printk("Node %ld ", zone_to_nid(zone));
  1410 + printk("Node %d ", zone_to_nid(zone));
1411 1411 }
1412 1412  
1413 1413 void si_meminfo(struct sysinfo *val)
... ... @@ -36,7 +36,7 @@
36 36 static u16 section_to_node_table[NR_MEM_SECTIONS] __cacheline_aligned;
37 37 #endif
38 38  
39   -unsigned long page_to_nid(struct page *page)
  39 +int page_to_nid(struct page *page)
40 40 {
41 41 return section_to_node_table[page_to_section(page)];
42 42 }