mask ADT: ia64 changes from Matthew's nodemask_t Patch 6/7 [15/22]
PATCH 1/1 mask ADT: ia64 changes from Matthew's nodemask_t Patch 6/7 [15/22]
Patch_15_of_22 - Matthew Dobson's [PATCH]_nodemask_t_ia64_changes_[6_7]
Changes to ia64 specific code. Untested.
Code review & testing requested.
diffstat Patch_15_of_22:
arch/ia64/kernel/acpi.c | 15 +++++---- arch/ia64/kernel/smpboot.c | 2 - arch/ia64/mm/discontig.c | 48 ++++++++++++++++--------------- arch/ia64/mm/hugetlbpage.c | 9 ++--- arch/ia64/mm/numa.c | 6 +-- arch/ia64/sn/fakeprom/fpmem.c | 8 ++--- arch/ia64/sn/io/machvec/pci_bus_cvlink.c | 3 - arch/ia64/sn/io/sn2/klconflib.c | 4 +- arch/ia64/sn/io/sn2/klgraph.c | 4 +- arch/ia64/sn/io/sn2/ml_SN_init.c | 2 - arch/ia64/sn/io/sn2/ml_SN_intr.c | 4 +- arch/ia64/sn/io/sn2/ml_iograph.c | 2 - arch/ia64/sn/io/sn2/module.c | 4 +- arch/ia64/sn/io/sn2/pcibr/pcibr_dvr.c | 4 +- arch/ia64/sn/io/sn2/shub.c | 18 +++++++---- arch/ia64/sn/kernel/setup.c | 12 +++---- arch/ia64/sn/kernel/sn2/prominfo_proc.c | 16 +++++----- arch/ia64/sn/kernel/sn2/sn2_smp.c | 2 - include/asm-ia64/numa.h | 2 - include/asm-ia64/sn/sn2/sn_private.h | 4 +- 20 files changed, 88 insertions(+), 81 deletions(-)
# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas:
# ChangeSet 1.1721 -> 1.1722
# arch/ia64/sn/io/sn2/ml_iograph.c 1.20 -> 1.21
# arch/ia64/sn/io/sn2/ml_SN_init.c 1.11 -> 1.12
# arch/ia64/sn/io/sn2/klconflib.c 1.14 -> 1.15
# arch/ia64/sn/io/sn2/module.c 1.10 -> 1.11
# include/asm-ia64/sn/sn2/sn_private.h 1.13 -> 1.14
# arch/ia64/sn/kernel/sn2/prominfo_proc.c 1.3 -> 1.4
# arch/ia64/kernel/smpboot.c 1.47 -> 1.48
# arch/ia64/sn/kernel/setup.c 1.33 -> 1.34
# arch/ia64/mm/numa.c 1.7 -> 1.8
# include/asm-ia64/numa.h 1.15 -> 1.16
# arch/ia64/sn/fakeprom/fpmem.c 1.8 -> 1.9
# arch/ia64/kernel/acpi.c 1.63 -> 1.64
# arch/ia64/mm/hugetlbpage.c 1.18 -> 1.19
# arch/ia64/sn/io/sn2/shub.c 1.13 -> 1.14
# arch/ia64/sn/io/sn2/klgraph.c 1.12 -> 1.13
# arch/ia64/sn/io/sn2/ml_SN_intr.c 1.10 -> 1.11
# arch/ia64/sn/io/machvec/pci_bus_cvlink.c 1.36 -> 1.37
# arch/ia64/mm/discontig.c 1.12 -> 1.13
# arch/ia64/sn/kernel/sn2/sn2_smp.c 1.10 -> 1.11
# arch/ia64/sn/io/sn2/pcibr/pcibr_dvr.c 1.29 -> 1.30
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 04/03/28 [email protected] 1.1722
# Matthew Dobson's [PATCH]_nodemask_t_ia64_changes_[6_7] of 18 Mar 2004:
# Changes to ia64 specific code. Untested.
# Code review & testing requested.
# --------------------------------------------
#
arch/ia64/kernel/acpi.c +8 -7
@@ -450,14 +450,15 @@ }/* calculate total number of nodes in system from PXM bitmap */ - numnodes =0 ;/* init total nodes in system */ +nodes_clear (node_online_map);/* init total nodes in system */ memset (pxm_to_nid_map,-1 ,sizeof (pxm_to_nid_map));memset (nid_to_pxm_map,-1 ,sizeof (nid_to_pxm_map));for (i =0 ; i <MAX_PXM_DOMAINS ; i++) {if (pxm_bit_test (i)) { - pxm_to_nid_map[i] = numnodes; - nid_to_pxm_map[numnodes++] = i; + pxm_to_nid_map[i] =num_online_nodes (); + nid_to_pxm_map[num_online_nodes ()] = i; +node_set_online (num_online_nodes ()); } }
@@ -466,7 +467,7 @@ node_memblk[i].nid = pxm_to_nid_map[node_memblk[i].nid];/* assign memory bank numbers for each chunk on each node */ -for (i =0 ; i < numnodes; i++) { +for_each_online_node (i) {int bank; bank =0 ;
@@ -479,7 +480,7 @@for (i =0 ; i < srat_num_cpus; i++) node_cpuid[i].nid = pxm_to_nid_map[node_cpuid[i].nid]; -printk (KERN_INFO "Number of logical nodes in system = %d\n" , numnodes); +printk (KERN_INFO "Number of logical nodes in system = %d\n" ,num_online_nodes ());printk (KERN_INFO "Number of memory chunks in system = %d\n" , num_node_memblks);if (!slit_table)return ;
@@ -499,8 +500,8 @@#ifdef SLIT_DEBUG printk ("ACPI 2.0 SLIT locality table:\n" ); -for (i =0 ; i < numnodes; i++) { -for (j =0 ; j < numnodes; j++) +for_each_online_node (i) { +for_each_online_node (j)printk ("%03d " ,node_distance (i,j));printk ("\n" ); }
arch/ia64/kernel/smpboot.c +1 -1
@@ -474,7 +474,7 @@ {int cpu, i, node; -for (node=0 ; node<MAX_NUMNODES ; node++) +for_each_node (node)cpus_clear (node_to_cpu_mask[node]);for (cpu =0 ; cpu <NR_CPUS ; ++cpu) {/*
arch/ia64/mm/discontig.c +26 -22
144 lines not on this page · raw message
arch/ia64/mm/hugetlbpage.c +4 -5
@@ -42,12 +42,11 @@struct page *page =NULL ;if (list_empty (&hugepage_freelists[nid])) { -for (nid =0 ; nid <MAX_NUMNODES ; ++nid) +for_each_node (nid)if (!list_empty (&hugepage_freelists[nid]))break ; } -if (nid >=0 && nid <MAX_NUMNODES && - !list_empty (&hugepage_freelists[nid])) { +if (node_possible (nid) && !list_empty (&hugepage_freelists[nid])) { page = list_entry(hugepage_freelists[nid].next, struct page, list);list_del (&page->list); }
@@ -59,7 +58,7 @@static int nid =0 ;struct page *page; page =alloc_pages_node (nid,GFP_HIGHUSER ,HUGETLB_PAGE_ORDER ); - nid = (nid +1 ) % numnodes; + nid = (nid +1 ) %num_online_nodes ();return page; }
@@ -557,7 +556,7 @@int i;struct page *page; -for (i =0 ; i <MAX_NUMNODES ; ++i) +for_each_node (i)INIT_LIST_HEAD (&hugepage_freelists[i]);for (i =0 ; i < htlbpage_max; ++i) {
arch/ia64/mm/numa.c +3 -3
@@ -54,12 +54,12 @@ {int i, err =0 ; - sysfs_nodes =kmalloc (sizeof (struct node ) * numnodes,GFP_KERNEL ); + sysfs_nodes =kmalloc (sizeof (struct node ) *num_online_nodes (),GFP_KERNEL );if (!sysfs_nodes) { err = -ENOMEM ; goto out; } -memset (sysfs_nodes,0 ,sizeof (struct node ) * numnodes); +memset (sysfs_nodes,0 ,sizeof (struct node ) *num_online_nodes ()); sysfs_cpus =kmalloc (sizeof (struct cpu ) *NR_CPUS ,GFP_KERNEL );if (!sysfs_cpus) {
@@ -69,7 +69,7 @@ }memset (sysfs_cpus,0 ,sizeof (struct cpu ) *NR_CPUS ); -for (i =0 ; i < numnodes; i++) +for_each_online_node (i)if ((err =register_node (&sysfs_nodes[i], i,0 ))) goto out;
arch/ia64/sn/fakeprom/fpmem.c +4 -4
@@ -26,7 +26,7 @@* * 32 bit 32 bit * -* numnodes numcpus +* num_nodes numcpus * * 16 bit 16 bit 32 bit * nasid0 cpuconf membankdesc0
@@ -59,7 +59,7 @@#endif /* -* For SN, this may not take an arg and gets the numnodes from +* For SN, this may not take an arg and gets the num_nodes from * the prom variable or by traversing klcfg or promcfg */ int
@@ -144,7 +144,7 @@int build_efi_memmap (void *md,int mdsize) { -int numnodes =GetNumNodes () ; +int num_nodes =GetNumNodes () ;int cnode,bank ;int nasid ;node_memmap_t membank_info ;
@@ -153,7 +153,7 @@long paddr, hole, numbytes; -for (cnode=0 ;cnode<numnodes;cnode++) { +for (cnode=0 ; cnode<num_nodes; cnode++) { nasid =GetNasid (cnode) ; membank_info =GetMemBankInfo (cnode) ;for (bank=0 ;bank<MD_BANKS_PER_NODE ;bank++) {
arch/ia64/sn/io/machvec/pci_bus_cvlink.c +1 -2
@@ -791,7 +791,6 @@struct list_head *ln;struct pci_bus *pci_bus =NULL ;struct pci_dev *pci_dev =NULL ; -extern int numnodes;int cnode, ret;#ifdef CONFIG_PROC_FS extern void register_sn_procfs (void );
@@ -814,7 +813,7 @@sgi_master_io_infr_init (); -for (cnode =0 ; cnode < numnodes; cnode++) { +for_each_online_node (cnode) {extern void intr_init_vecblk (cnodeid_t );intr_init_vecblk (cnode); }
arch/ia64/sn/io/sn2/klconflib.c +2 -2
@@ -62,7 +62,7 @@ (start->brd_nasid == nasid))return start; -if (numionodes == numnodes) +if (numionodes ==num_online_nodes ()) start =KLCF_NEXT_ANY (start);else start =KLCF_NEXT (start);
@@ -95,7 +95,7 @@ (start->brd_nasid == nasid))return start; -if (numionodes == numnodes) +if (numionodes ==num_online_nodes ()) start =KLCF_NEXT_ANY (start);else start =KLCF_NEXT (start);
arch/ia64/sn/io/sn2/klgraph.c +2 -2
@@ -279,7 +279,7 @@char path_buffer[100 ];int rv; -for (cnode =0 ; cnode < numnodes; cnode++) { +for_each_online_node (cnode) { nasid =COMPACT_TO_NASID_NODEID (cnode); brd =find_lboard_class_any ((lboard_t *)KL_CONFIG_INFO (nasid),KLTYPE_ROUTER );
@@ -413,7 +413,7 @@cnodeid_t cnode;lboard_t *brd; -for (cnode =0 ; cnode < numnodes; cnode++) { +for_each_online_node (cnode) { nasid =COMPACT_TO_NASID_NODEID (cnode); brd =find_lboard_class_any ((lboard_t *)KL_CONFIG_INFO (nasid),KLTYPE_ROUTER );
arch/ia64/sn/io/sn2/ml_SN_init.c +1 -1
@@ -38,7 +38,7 @@/* Allocate per-node platform-dependent data */ nasid =COMPACT_TO_NASID_NODEID (node); -if (node >= numnodes)/* Headless/memless IO nodes */ +if (node >=num_online_nodes ())/* Headless/memless IO nodes */ hubinfo = (hubinfo_t )alloc_bootmem_node (NODE_DATA (0 ),sizeof (struct hubinfo_s ));else hubinfo = (hubinfo_t )alloc_bootmem_node (NODE_DATA (node),sizeof (struct hubinfo_s ));
arch/ia64/sn/io/sn2/ml_SN_intr.c +2 -2
@@ -256,12 +256,12 @@cnodeid_t candidate_node;cpuid_t cpuid; -if (last_node >= numnodes) +if (last_node >=num_online_nodes ()) last_node =0 ;for (candidate_node = last_node +1 ; candidate_node != last_node; candidate_node++) { -if (candidate_node == numnodes) +if (candidate_node ==num_online_nodes ()) candidate_node =0 ; cpuid =intr_cpu_choose_from_node (candidate_node);if (cpuid !=CPU_NONE )
arch/ia64/sn/io/sn2/ml_iograph.c +1 -1
@@ -680,7 +680,7 @@DBG ("init_all_devices: Done io_init_node() for cnode %d\n" , cnodeid); } -for (cnodeid =0 ; cnodeid < numnodes; cnodeid++) { +for_each_online_node (cnodeid) {/* * Update information generated by IO init. */
arch/ia64/sn/io/sn2/module.c +2 -2
@@ -195,7 +195,7 @@* First pass just scan for compute node boards KLTYPE_SNIA. * We do not support memoryless compute nodes. */ -for (node =0 ; node < numnodes; node++) { +for_each_online_node (node) { nasid =COMPACT_TO_NASID_NODEID (node); board =find_lboard_nasid ((lboard_t *)KL_CONFIG_INFO (nasid), nasid,KLTYPE_SNIA );ASSERT (board);
@@ -210,7 +210,7 @@/* * Second scan, look for headless/memless board hosted by compute nodes. */ -for (node = numnodes; node < numionodes; node++) { +for (node =num_online_nodes (); node < numionodes; node++) {nasid_t nasid;char serial_number[16 ];
arch/ia64/sn/io/sn2/pcibr/pcibr_dvr.c +2 -2
@@ -2639,7 +2639,7 @@if (brd->brd_flags &LOCAL_MASTER_IO6 ) {return 1 ; } -if (numionodes == numnodes) +if (numionodes ==num_online_nodes ()) brd =KLCF_NEXT_ANY (brd);else brd =KLCF_NEXT (brd);
@@ -2652,7 +2652,7 @@if (brd->brd_flags &LOCAL_MASTER_IO6 ) {return 1 ; } -if (numionodes == numnodes) +if (numionodes ==num_online_nodes ()) brd =KLCF_NEXT_ANY (brd);else brd =KLCF_NEXT (brd);
arch/ia64/sn/io/sn2/shub.c +11 -7
@@ -165,7 +165,7 @@int nasid; cnode = (cnodeid_t )file->f_dentry->d_fsdata; -if (cnode <0 || cnode >= numnodes) +if (cnode <0 || cnode >=num_online_nodes ())return -ENODEV ;switch (cmd) {
@@ -239,8 +239,8 @@uint64_t llp_csr_reg;spin_lock (&sn_linkstats_lock); -memset (sn_linkstats,0 , numnodes *sizeof (struct s_linkstats )); -for (cnode=0 ; cnode < numnodes; cnode++) { +memset (sn_linkstats,0 ,num_online_nodes () *sizeof (struct s_linkstats )); +for_each_online_node (cnode) {shub_mmr_write (cnode,SH_NI0_LLP_ERR ,0L );shub_mmr_write (cnode,SH_NI1_LLP_ERR ,0L );shub_mmr_write_iospace (cnode,IIO_LLP_LOG ,0L );
@@ -286,7 +286,8 @@spin_lock (&sn_linkstats_lock); overflows =0 ; -for (lsp=sn_linkstats, cnode=0 ; cnode < numnodes; cnode++, lsp++) { + lsp = sn_linkstats; +for_each_online_node (cnode) { reg[0 ] =shub_mmr_read (cnode,SH_NI0_LLP_ERR ); reg[1 ] =shub_mmr_read (cnode,SH_NI1_LLP_ERR );if (lsp->hs_ii_up) {
@@ -349,6 +350,7 @@ iio_wstat &=0xffffffffff00ffff ;/* bits 23:16 */ shub_mmr_write_iospace (cnode,IIO_WSTAT , iio_wstat); } + lsp++; } sn_linkstats_samples++;
@@ -401,7 +403,8 @@ n +=sprintf (page+n,"%-37s %8s %8s %8s %8s\n" ,"# Numalink" ,"sn errs" ,"cb errs" ,"cb/min" ,"retries" ); -for (lsp=sn_linkstats, cnode=0 ; cnode < numnodes; cnode++, lsp++) { + lsp = sn_linkstats; +for_each_online_node (cnode) { npda =NODEPDA (cnode);/* two NL links on each SHub */
@@ -411,7 +414,7 @@ retrysum += lsp->hs_ni_retry_errors[nlport];/* avoid buffer overrun (should be using seq_read API) */ -if (numnodes >64 ) +if (num_online_nodes () >64 )continue ; n += sprintf(page + n, "/%s/link/%d %8lu %8lu %8s %8lu\n",
@@ -432,6 +435,7 @@ cbsum_ii += lsp->hs_ii_cb_errors; retrysum_ii += lsp->hs_ii_retry_errors; } + lsp++; } n += sprintf(page + n, "%-37s %8lu %8lu %8s %8lu\n",
@@ -454,7 +458,7 @@return -ENODEV ;spin_lock_init (&sn_linkstats_lock); - sn_linkstats =kmalloc (numnodes *sizeof (struct s_linkstats ),GFP_KERNEL ); + sn_linkstats =kmalloc (num_online_nodes () *sizeof (struct s_linkstats ),GFP_KERNEL );sn_linkstats_reset (60000UL );/* default 60 second update interval */ kernel_thread (linkstatd_thread,NULL ,CLONE_KERNEL );
arch/ia64/sn/kernel/setup.c +6 -6
@@ -224,7 +224,7 @@ {int cnode; -for (cnode=0 ; cnode< numnodes; cnode++) +for_each_online_node (cnode)if (is_shub_1_1 (cnodeid_to_nasid (cnode))) shub_1_1_found =1 ; }
@@ -372,16 +372,16 @@panic ("overflow of cpu_data page" );memset (pda->cnodeid_to_nasid_table,-1 ,sizeof (pda->cnodeid_to_nasid_table)); -for (cnode=0 ; cnode<numnodes; cnode++) +for_each_online_node (cnode) pda->cnodeid_to_nasid_table[cnode] =pxm_to_nasid (nid_to_pxm_map[cnode]); - numionodes = numnodes; + numionodes =num_online_nodes ();scan_for_ionodes ();/* * Allocate & initalize the nodepda for each node. */ -for (cnode=0 ; cnode < numnodes; cnode++) { +for_each_online_node (cnode) { nodepdaindr[cnode] =alloc_bootmem_node (NODE_DATA (cnode),sizeof (nodepda_t));memset (nodepdaindr[cnode],0 ,sizeof (nodepda_t)); }
@@ -398,7 +398,7 @@* The following routine actually sets up the hubinfo struct * in nodepda. */ -for (cnode =0 ; cnode < numnodes; cnode++) { +for_each_online_node (cnode) {init_platform_nodepda (nodepdaindr[cnode], cnode);bte_init_node (nodepdaindr[cnode], cnode); }
@@ -486,7 +486,7 @@if (nodepda->node_first_cpu == cpuid) {int buddy_nasid; - buddy_nasid =cnodeid_to_nasid (numa_node_id () == numnodes-1 ?0 :numa_node_id ()+1 ); + buddy_nasid =cnodeid_to_nasid (numa_node_id () ==num_online_nodes ()-1 ?0 :numa_node_id ()+1 ); pda->pio_shub_war_cam_addr = (volatile unsigned long *)GLOBAL_MMR_ADDR (nasid,SH_PI_CAM_CONTROL ); }
arch/ia64/sn/kernel/sn2/prominfo_proc.c +8 -8
@@ -320,16 +320,15 @@TRACE ();DPRINTK ("running on cpu %d\n" ,smp_processor_id ()); -DPRINTK ("numnodes %d\n" , numnodes); +DPRINTK ("num_online_nodes() %d\n" ,num_online_nodes ()); - proc_entries =kmalloc (numnodes *sizeof (struct proc_dir_entry *), + proc_entries =kmalloc (num_online_nodes () *sizeof (struct proc_dir_entry *),GFP_KERNEL ); sgi_prominfo_entry =proc_mkdir ("sgi_prominfo" ,NULL ); -for (cnodeid =0 , entp = proc_entries; - cnodeid < numnodes; - cnodeid++, entp++) { + entp = proc_entries; +for_each_online_node (cnodeid) {sprintf (name,"node%d" , cnodeid); *entp =proc_mkdir (name, sgi_prominfo_entry); nasid =cnodeid_to_nasid (cnodeid);
@@ -339,6 +338,7 @@create_proc_read_entry ("version" ,0 , *entp, read_version_entry,lookup_fit (nasid)); + entp++; }return 0 ;
@@ -353,13 +353,13 @@TRACE (); -for (cnodeid =0 , entp = proc_entries; - cnodeid < numnodes; - cnodeid++, entp++) { + entp = proc_entries; +for_each_online_node (cnodeid) {remove_proc_entry ("fit" , *entp);remove_proc_entry ("version" , *entp);sprintf (name,"node%d" , cnodeid);remove_proc_entry (name, sgi_prominfo_entry); + entp++; }remove_proc_entry ("sgi_prominfo" ,NULL );kfree (proc_entries);
arch/ia64/sn/kernel/sn2/sn2_smp.c +1 -1
@@ -183,7 +183,7 @@ mycnode =numa_node_id (); -for (cnode =0 ; cnode < numnodes; cnode++) { +for_each_online_node (cnode) {if (is_headless_node (cnode) || cnode == mycnode)continue ; nasid =cnodeid_to_nasid (cnode);
include/asm-ia64/numa.h +1 -1
@@ -59,7 +59,7 @@*/ extern u8 numa_slit[MAX_NUMNODES *MAX_NUMNODES ]; -#define node_distance (from,to) (numa_slit[from * numnodes + to]) +#define node_distance (from,to) (numa_slit[from * num_online_nodes() + to])extern int paddr_to_nid (unsigned long paddr);
include/asm-ia64/sn/sn2/sn_private.h +2 -2
@@ -87,9 +87,9 @@void install_klidbg_functions (void );/* klnuma.c */ -extern void replicate_kernel_text (int numnodes); +extern void replicate_kernel_text (void );/* TODO: is this used??? */ extern unsigned long get_freemem_start (cnodeid_t cnode); -extern void setup_replication_mask (int maxnodes); +extern void setup_replication_mask (void );/* TODO: is this used??? */ /* init.c */ extern cnodeid_t get_compact_nodeid (void );/* get compact node id */
Signature · 3 lines
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <[email protected]> 1.650.933.1373Quoted 3 lines · Paul Jackson
Patch_15_of_22- Matthew Dobson's [PATCH]_nodemask_t_ia64_changes_[6_7]
Changes to ia64 specific code. Untested.
Code review & testing requested.
Yet another updated patch. Changes are very small, but I've attatched the whole patch, rather than an incremental diff. In include/asm-ia64/sn/sn2/sn_private.h, we can safely drop the externs of replicate_kernel_text() & setup_replication_mask() as they are unused on ia64.
-Matt
arch/ia64/kernel/acpi.c +8 -7
@@ -450,14 +450,15 @@ acpi_numa_arch_fixup (void) }/* calculate total number of nodes in system from PXM bitmap */ - numnodes =0 ;/* init total nodes in system */ +nodes_clear (node_online_map);/* init total nodes in system */ memset (pxm_to_nid_map,-1 ,sizeof (pxm_to_nid_map));memset (nid_to_pxm_map,-1 ,sizeof (nid_to_pxm_map));for (i =0 ; i <MAX_PXM_DOMAINS ; i++) {if (pxm_bit_test (i)) { - pxm_to_nid_map[i] = numnodes; - nid_to_pxm_map[numnodes++] = i; + pxm_to_nid_map[i] =num_online_nodes (); + nid_to_pxm_map[num_online_nodes ()] = i; +node_set_online (num_online_nodes ()); } }
@@ -466,7 +467,7 @@ acpi_numa_arch_fixup (void) node_memblk[i].nid = pxm_to_nid_map[node_memblk[i].nid];/* assign memory bank numbers for each chunk on each node */ -for (i =0 ; i < numnodes; i++) { +for_each_online_node (i) {int bank; bank =0 ;
@@ -479,7 +480,7 @@ acpi_numa_arch_fixup (void)for (i =0 ; i < srat_num_cpus; i++) node_cpuid[i].nid = pxm_to_nid_map[node_cpuid[i].nid]; -printk (KERN_INFO "Number of logical nodes in system = %d\n" , numnodes); +printk (KERN_INFO "Number of logical nodes in system = %d\n" ,num_online_nodes ());printk (KERN_INFO "Number of memory chunks in system = %d\n" , num_node_memblks);if (!slit_table)return ;
@@ -499,8 +500,8 @@ acpi_numa_arch_fixup (void)#ifdef SLIT_DEBUG printk ("ACPI 2.0 SLIT locality table:\n" ); -for (i =0 ; i < numnodes; i++) { -for (j =0 ; j < numnodes; j++) +for_each_online_node (i) { +for_each_online_node (j)printk ("%03d " ,node_distance (i,j));printk ("\n" ); }
arch/ia64/kernel/smpboot.c +1 -1
@@ -474,7 +474,7 @@ build_cpu_to_node_map (void) {int cpu, i, node; -for (node=0 ; node<MAX_NUMNODES ; node++) +for_each_node (node)cpus_clear (node_to_cpu_mask[node]);for (cpu =0 ; cpu <NR_CPUS ; ++cpu) {/*
arch/ia64/mm/discontig.c +26 -22
144 lines not on this page · raw message
arch/ia64/mm/hugetlbpage.c +4 -5
@@ -42,12 +42,11 @@ static struct page *dequeue_huge_page(vostruct page *page =NULL ;if (list_empty (&hugepage_freelists[nid])) { -for (nid =0 ; nid <MAX_NUMNODES ; ++nid) +for_each_node (nid)if (!list_empty (&hugepage_freelists[nid]))break ; } -if (nid >=0 && nid <MAX_NUMNODES && - !list_empty (&hugepage_freelists[nid])) { +if (node_possible (nid) && !list_empty (&hugepage_freelists[nid])) { page = list_entry(hugepage_freelists[nid].next, struct page, list);list_del (&page->list); }
@@ -59,7 +58,7 @@ static struct page *alloc_fresh_huge_pagstatic int nid =0 ;struct page *page; page =alloc_pages_node (nid,GFP_HIGHUSER ,HUGETLB_PAGE_ORDER ); - nid = (nid +1 ) % numnodes; + nid = (nid +1 ) %num_online_nodes ();return page; }
@@ -557,7 +556,7 @@ static int __init hugetlb_init(void)int i;struct page *page; -for (i =0 ; i <MAX_NUMNODES ; ++i) +for_each_node (i)INIT_LIST_HEAD (&hugepage_freelists[i]);for (i =0 ; i < htlbpage_max; ++i) {
arch/ia64/mm/numa.c +3 -3
@@ -54,12 +54,12 @@ static int __init topology_init(void) {int i, err =0 ; - sysfs_nodes =kmalloc (sizeof (struct node ) * numnodes,GFP_KERNEL ); + sysfs_nodes =kmalloc (sizeof (struct node ) *num_online_nodes (),GFP_KERNEL );if (!sysfs_nodes) { err = -ENOMEM ; goto out; } -memset (sysfs_nodes,0 ,sizeof (struct node ) * numnodes); +memset (sysfs_nodes,0 ,sizeof (struct node ) *num_online_nodes ()); sysfs_cpus =kmalloc (sizeof (struct cpu ) *NR_CPUS ,GFP_KERNEL );if (!sysfs_cpus) {
@@ -69,7 +69,7 @@ static int __init topology_init(void) }memset (sysfs_cpus,0 ,sizeof (struct cpu ) *NR_CPUS ); -for (i =0 ; i < numnodes; i++) +for_each_online_node (i)if ((err =register_node (&sysfs_nodes[i], i,0 ))) goto out;
arch/ia64/sn/fakeprom/fpmem.c +4 -4
@@ -26,7 +26,7 @@* * 32 bit 32 bit * -* numnodes numcpus +* num_nodes numcpus * * 16 bit 16 bit 32 bit * nasid0 cpuconf membankdesc0
@@ -59,7 +59,7 @@ sn_config_t *sn_config ;#endif /* -* For SN, this may not take an arg and gets the numnodes from +* For SN, this may not take an arg and gets the num_nodes from * the prom variable or by traversing klcfg or promcfg */ int
@@ -144,7 +144,7 @@ build_mem_desc(efi_memory_desc_t *md, inint build_efi_memmap (void *md,int mdsize) { -int numnodes =GetNumNodes () ; +int num_nodes =GetNumNodes () ;int cnode,bank ;int nasid ;node_memmap_t membank_info ;
@@ -153,7 +153,7 @@ build_efi_memmap(void *md, int mdsize)long paddr, hole, numbytes; -for (cnode=0 ;cnode<numnodes;cnode++) { +for (cnode=0 ; cnode<num_nodes; cnode++) { nasid =GetNasid (cnode) ; membank_info =GetMemBankInfo (cnode) ;for (bank=0 ;bank<MD_BANKS_PER_NODE ;bank++) {
arch/ia64/sn/io/machvec/pci_bus_cvlink.c +1 -2
@@ -791,7 +791,6 @@ sn_pci_init (void)struct list_head *ln;struct pci_bus *pci_bus =NULL ;struct pci_dev *pci_dev =NULL ; -extern int numnodes;int cnode, ret;#ifdef CONFIG_PROC_FS extern void register_sn_procfs (void );
@@ -814,7 +813,7 @@ sn_pci_init (void)sgi_master_io_infr_init (); -for (cnode =0 ; cnode < numnodes; cnode++) { +for_each_online_node (cnode) {extern void intr_init_vecblk (cnodeid_t );intr_init_vecblk (cnode); }
arch/ia64/sn/io/sn2/klconflib.c +2 -2
@@ -62,7 +62,7 @@ find_lboard_nasid(lboard_t *start, nasid (start->brd_nasid == nasid))return start; -if (numionodes == numnodes) +if (numionodes ==num_online_nodes ()) start =KLCF_NEXT_ANY (start);else start =KLCF_NEXT (start);
@@ -95,7 +95,7 @@ find_lboard_class_nasid(lboard_t *start, (start->brd_nasid == nasid))return start; -if (numionodes == numnodes) +if (numionodes ==num_online_nodes ()) start =KLCF_NEXT_ANY (start);else start =KLCF_NEXT (start);
arch/ia64/sn/io/sn2/klgraph.c +2 -2
@@ -279,7 +279,7 @@ klhwg_add_all_routers(vertex_hdl_t hwgrachar path_buffer[100 ];int rv; -for (cnode =0 ; cnode < numnodes; cnode++) { +for_each_online_node (cnode) { nasid =COMPACT_TO_NASID_NODEID (cnode); brd =find_lboard_class_any ((lboard_t *)KL_CONFIG_INFO (nasid),KLTYPE_ROUTER );
@@ -413,7 +413,7 @@ klhwg_connect_routers(vertex_hdl_t hwgracnodeid_t cnode;lboard_t *brd; -for (cnode =0 ; cnode < numnodes; cnode++) { +for_each_online_node (cnode) { nasid =COMPACT_TO_NASID_NODEID (cnode); brd =find_lboard_class_any ((lboard_t *)KL_CONFIG_INFO (nasid),KLTYPE_ROUTER );
arch/ia64/sn/io/sn2/ml_SN_init.c +1 -1
@@ -38,7 +38,7 @@ void init_platform_nodepda(nodepda_t *np/* Allocate per-node platform-dependent data */ nasid =COMPACT_TO_NASID_NODEID (node); -if (node >= numnodes)/* Headless/memless IO nodes */ +if (node >=num_online_nodes ())/* Headless/memless IO nodes */ hubinfo = (hubinfo_t )alloc_bootmem_node (NODE_DATA (0 ),sizeof (struct hubinfo_s ));else hubinfo = (hubinfo_t )alloc_bootmem_node (NODE_DATA (node),sizeof (struct hubinfo_s ));
arch/ia64/sn/io/sn2/ml_SN_intr.c +2 -2
@@ -256,12 +256,12 @@ static cpuid_t intr_cpu_choose_node(voidcnodeid_t candidate_node;cpuid_t cpuid; -if (last_node >= numnodes) +if (last_node >=num_online_nodes ()) last_node =0 ;for (candidate_node = last_node +1 ; candidate_node != last_node; candidate_node++) { -if (candidate_node == numnodes) +if (candidate_node ==num_online_nodes ()) candidate_node =0 ; cpuid =intr_cpu_choose_from_node (candidate_node);if (cpuid !=CPU_NONE )
arch/ia64/sn/io/sn2/ml_iograph.c +1 -1
@@ -680,7 +680,7 @@ init_all_devices(void)DBG ("init_all_devices: Done io_init_node() for cnode %d\n" , cnodeid); } -for (cnodeid =0 ; cnodeid < numnodes; cnodeid++) { +for_each_online_node (cnodeid) {/* * Update information generated by IO init. */
arch/ia64/sn/io/sn2/module.c +2 -2
@@ -195,7 +195,7 @@ io_module_init(void)* First pass just scan for compute node boards KLTYPE_SNIA. * We do not support memoryless compute nodes. */ -for (node =0 ; node < numnodes; node++) { +for_each_online_node (node) { nasid =COMPACT_TO_NASID_NODEID (node); board =find_lboard_nasid ((lboard_t *)KL_CONFIG_INFO (nasid), nasid,KLTYPE_SNIA );ASSERT (board);
@@ -210,7 +210,7 @@ io_module_init(void)/* * Second scan, look for headless/memless board hosted by compute nodes. */ -for (node = numnodes; node < numionodes; node++) { +for (node =num_online_nodes (); node < numionodes; node++) {nasid_t nasid;char serial_number[16 ];
arch/ia64/sn/io/sn2/pcibr/pcibr_dvr.c +2 -2
@@ -2639,7 +2639,7 @@ isIO9(nasid_t nasid)if (brd->brd_flags &LOCAL_MASTER_IO6 ) {return 1 ; } -if (numionodes == numnodes) +if (numionodes ==num_online_nodes ()) brd =KLCF_NEXT_ANY (brd);else brd =KLCF_NEXT (brd);
@@ -2652,7 +2652,7 @@ isIO9(nasid_t nasid)if (brd->brd_flags &LOCAL_MASTER_IO6 ) {return 1 ; } -if (numionodes == numnodes) +if (numionodes ==num_online_nodes ()) brd =KLCF_NEXT_ANY (brd);else brd =KLCF_NEXT (brd);
arch/ia64/sn/io/sn2/shub.c +11 -7
@@ -165,7 +165,7 @@ shubstats_ioctl(struct inode *inode, strint nasid; cnode = (cnodeid_t )file->f_dentry->d_fsdata; -if (cnode <0 || cnode >= numnodes) +if (cnode <0 || cnode >=num_online_nodes ())return -ENODEV ;switch (cmd) {
@@ -239,8 +239,8 @@ sn_linkstats_reset(unsigned long msecs)uint64_t llp_csr_reg;spin_lock (&sn_linkstats_lock); -memset (sn_linkstats,0 , numnodes *sizeof (struct s_linkstats )); -for (cnode=0 ; cnode < numnodes; cnode++) { +memset (sn_linkstats,0 ,num_online_nodes () *sizeof (struct s_linkstats )); +for_each_online_node (cnode) {shub_mmr_write (cnode,SH_NI0_LLP_ERR ,0L );shub_mmr_write (cnode,SH_NI1_LLP_ERR ,0L );shub_mmr_write_iospace (cnode,IIO_LLP_LOG ,0L );
@@ -286,7 +286,8 @@ linkstatd_thread(void *unused)spin_lock (&sn_linkstats_lock); overflows =0 ; -for (lsp=sn_linkstats, cnode=0 ; cnode < numnodes; cnode++, lsp++) { + lsp = sn_linkstats; +for_each_online_node (cnode) { reg[0 ] =shub_mmr_read (cnode,SH_NI0_LLP_ERR ); reg[1 ] =shub_mmr_read (cnode,SH_NI1_LLP_ERR );if (lsp->hs_ii_up) {
@@ -349,6 +350,7 @@ linkstatd_thread(void *unused) iio_wstat &=0xffffffffff00ffff ;/* bits 23:16 */ shub_mmr_write_iospace (cnode,IIO_WSTAT , iio_wstat); } + lsp++; } sn_linkstats_samples++;
@@ -401,7 +403,8 @@ sn_linkstats_get(char *page) n +=sprintf (page+n,"%-37s %8s %8s %8s %8s\n" ,"# Numalink" ,"sn errs" ,"cb errs" ,"cb/min" ,"retries" ); -for (lsp=sn_linkstats, cnode=0 ; cnode < numnodes; cnode++, lsp++) { + lsp = sn_linkstats; +for_each_online_node (cnode) { npda =NODEPDA (cnode);/* two NL links on each SHub */
@@ -411,7 +414,7 @@ sn_linkstats_get(char *page) retrysum += lsp->hs_ni_retry_errors[nlport];/* avoid buffer overrun (should be using seq_read API) */ -if (numnodes >64 ) +if (num_online_nodes () >64 )continue ; n += sprintf(page + n, "/%s/link/%d %8lu %8lu %8s %8lu\n",
@@ -432,6 +435,7 @@ sn_linkstats_get(char *page) cbsum_ii += lsp->hs_ii_cb_errors; retrysum_ii += lsp->hs_ii_retry_errors; } + lsp++; } n += sprintf(page + n, "%-37s %8lu %8lu %8s %8lu\n",
@@ -454,7 +458,7 @@ linkstatd_init(void)return -ENODEV ;spin_lock_init (&sn_linkstats_lock); - sn_linkstats =kmalloc (numnodes *sizeof (struct s_linkstats ),GFP_KERNEL ); + sn_linkstats =kmalloc (num_online_nodes () *sizeof (struct s_linkstats ),GFP_KERNEL );sn_linkstats_reset (60000UL );/* default 60 second update interval */ kernel_thread (linkstatd_thread,NULL ,CLONE_KERNEL );
arch/ia64/sn/kernel/setup.c +6 -6
@@ -224,7 +224,7 @@ sn_check_for_wars(void) {int cnode; -for (cnode=0 ; cnode< numnodes; cnode++) +for_each_online_node (cnode)if (is_shub_1_1 (cnodeid_to_nasid (cnode))) shub_1_1_found =1 ; }
@@ -372,16 +372,16 @@ sn_init_pdas(char **cmdline_p)panic ("overflow of cpu_data page" );memset (pda->cnodeid_to_nasid_table,-1 ,sizeof (pda->cnodeid_to_nasid_table)); -for (cnode=0 ; cnode<numnodes; cnode++) +for_each_online_node (cnode) pda->cnodeid_to_nasid_table[cnode] =pxm_to_nasid (nid_to_pxm_map[cnode]); - numionodes = numnodes; + numionodes =num_online_nodes ();scan_for_ionodes ();/* * Allocate & initalize the nodepda for each node. */ -for (cnode=0 ; cnode < numnodes; cnode++) { +for_each_online_node (cnode) { nodepdaindr[cnode] =alloc_bootmem_node (NODE_DATA (cnode),sizeof (nodepda_t));memset (nodepdaindr[cnode],0 ,sizeof (nodepda_t)); }
@@ -398,7 +398,7 @@ sn_init_pdas(char **cmdline_p)* The following routine actually sets up the hubinfo struct * in nodepda. */ -for (cnode =0 ; cnode < numnodes; cnode++) { +for_each_online_node (cnode) {init_platform_nodepda (nodepdaindr[cnode], cnode);bte_init_node (nodepdaindr[cnode], cnode); }
@@ -486,7 +486,7 @@ sn_cpu_init(void)if (nodepda->node_first_cpu == cpuid) {int buddy_nasid; - buddy_nasid =cnodeid_to_nasid (numa_node_id () == numnodes-1 ?0 :numa_node_id ()+1 ); + buddy_nasid =cnodeid_to_nasid (numa_node_id () ==num_online_nodes ()-1 ?0 :numa_node_id ()+1 ); pda->pio_shub_war_cam_addr = (volatile unsigned long *)GLOBAL_MMR_ADDR (nasid,SH_PI_CAM_CONTROL ); }
arch/ia64/sn/kernel/sn2/prominfo_proc.c +8 -8
@@ -320,16 +320,15 @@ prominfo_init(void)TRACE ();DPRINTK ("running on cpu %d\n" ,smp_processor_id ()); -DPRINTK ("numnodes %d\n" , numnodes); +DPRINTK ("num_online_nodes() %d\n" ,num_online_nodes ()); - proc_entries =kmalloc (numnodes *sizeof (struct proc_dir_entry *), + proc_entries =kmalloc (num_online_nodes () *sizeof (struct proc_dir_entry *),GFP_KERNEL ); sgi_prominfo_entry =proc_mkdir ("sgi_prominfo" ,NULL ); -for (cnodeid =0 , entp = proc_entries; - cnodeid < numnodes; - cnodeid++, entp++) { + entp = proc_entries; +for_each_online_node (cnodeid) {sprintf (name,"node%d" , cnodeid); *entp =proc_mkdir (name, sgi_prominfo_entry); nasid =cnodeid_to_nasid (cnodeid);
@@ -339,6 +338,7 @@ prominfo_init(void)create_proc_read_entry ("version" ,0 , *entp, read_version_entry,lookup_fit (nasid)); + entp++; }return 0 ;
@@ -353,13 +353,13 @@ prominfo_exit(void)TRACE (); -for (cnodeid =0 , entp = proc_entries; - cnodeid < numnodes; - cnodeid++, entp++) { + entp = proc_entries; +for_each_online_node (cnodeid) {remove_proc_entry ("fit" , *entp);remove_proc_entry ("version" , *entp);sprintf (name,"node%d" , cnodeid);remove_proc_entry (name, sgi_prominfo_entry); + entp++; }remove_proc_entry ("sgi_prominfo" ,NULL );kfree (proc_entries);
arch/ia64/sn/kernel/sn2/sn2_smp.c +1 -1
@@ -183,7 +183,7 @@ sn2_ptc_deadlock_recovery(unsigned long mycnode =numa_node_id (); -for (cnode =0 ; cnode < numnodes; cnode++) { +for_each_online_node (cnode) {if (is_headless_node (cnode) || cnode == mycnode)continue ; nasid =cnodeid_to_nasid (cnode);
include/asm-ia64/numa.h +1 -1
@@ -59,7 +59,7 @@ extern struct node_cpuid_s node_cpuid[NR*/ extern u8 numa_slit[MAX_NUMNODES *MAX_NUMNODES ]; -#define node_distance (from,to) (numa_slit[from * numnodes + to]) +#define node_distance (from,to) (numa_slit[from * num_online_nodes() + to])extern int paddr_to_nid (unsigned long paddr);
include/asm-ia64/sn/sn2/sn_private.h +0 -2
@@ -87,9 +87,7 @@ void klhwg_add_all_modules(vertex_hdl_t)void install_klidbg_functions (void );/* klnuma.c */ -extern void replicate_kernel_text (int numnodes);extern unsigned long get_freemem_start (cnodeid_t cnode); -extern void setup_replication_mask (int maxnodes);/* init.c */ extern cnodeid_t get_compact_nodeid (void );/* get compact node id */