~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/metag/mm/numa.c

Version: ~ [ linux-5.10-rc1 ] ~ [ linux-5.9.1 ] ~ [ linux-5.8.16 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.72 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.152 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.202 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.240 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.240 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.85 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  *  Multiple memory node support for Meta machines
  3  *
  4  *  Copyright (C) 2007  Paul Mundt
  5  *  Copyright (C) 2010  Imagination Technologies Ltd.
  6  *
  7  * This file is subject to the terms and conditions of the GNU General Public
  8  * License.  See the file "COPYING" in the main directory of this archive
  9  * for more details.
 10  */
 11 #include <linux/export.h>
 12 #include <linux/bootmem.h>
 13 #include <linux/memblock.h>
 14 #include <linux/mm.h>
 15 #include <linux/numa.h>
 16 #include <linux/pfn.h>
 17 #include <asm/sections.h>
 18 
 19 struct pglist_data *node_data[MAX_NUMNODES] __read_mostly;
 20 EXPORT_SYMBOL_GPL(node_data);
 21 
 22 extern char _heap_start[];
 23 
 24 /*
 25  * On Meta machines the conventional approach is to stash system RAM
 26  * in node 0, and other memory blocks in to node 1 and up, ordered by
 27  * latency. Each node's pgdat is node-local at the beginning of the node,
 28  * immediately followed by the node mem map.
 29  */
 30 void __init setup_bootmem_node(int nid, unsigned long start, unsigned long end)
 31 {
 32         unsigned long bootmap_pages, bootmem_paddr;
 33         unsigned long start_pfn, end_pfn;
 34         unsigned long pgdat_paddr;
 35 
 36         /* Don't allow bogus node assignment */
 37         BUG_ON(nid >= MAX_NUMNODES || nid <= 0);
 38 
 39         start_pfn = start >> PAGE_SHIFT;
 40         end_pfn = end >> PAGE_SHIFT;
 41 
 42         memblock_add(start, end - start);
 43 
 44         memblock_set_node(PFN_PHYS(start_pfn),
 45                           PFN_PHYS(end_pfn - start_pfn), nid);
 46 
 47         /* Node-local pgdat */
 48         pgdat_paddr = memblock_alloc_base(sizeof(struct pglist_data),
 49                                           SMP_CACHE_BYTES, end);
 50         NODE_DATA(nid) = __va(pgdat_paddr);
 51         memset(NODE_DATA(nid), 0, sizeof(struct pglist_data));
 52 
 53         NODE_DATA(nid)->bdata = &bootmem_node_data[nid];
 54         NODE_DATA(nid)->node_start_pfn = start_pfn;
 55         NODE_DATA(nid)->node_spanned_pages = end_pfn - start_pfn;
 56 
 57         /* Node-local bootmap */
 58         bootmap_pages = bootmem_bootmap_pages(end_pfn - start_pfn);
 59         bootmem_paddr = memblock_alloc_base(bootmap_pages << PAGE_SHIFT,
 60                                             PAGE_SIZE, end);
 61         init_bootmem_node(NODE_DATA(nid), bootmem_paddr >> PAGE_SHIFT,
 62                           start_pfn, end_pfn);
 63 
 64         free_bootmem_with_active_regions(nid, end_pfn);
 65 
 66         /* Reserve the pgdat and bootmap space with the bootmem allocator */
 67         reserve_bootmem_node(NODE_DATA(nid), pgdat_paddr & PAGE_MASK,
 68                              sizeof(struct pglist_data), BOOTMEM_DEFAULT);
 69         reserve_bootmem_node(NODE_DATA(nid), bootmem_paddr,
 70                              bootmap_pages << PAGE_SHIFT, BOOTMEM_DEFAULT);
 71 
 72         /* It's up */
 73         node_set_online(nid);
 74 
 75         /* Kick sparsemem */
 76         sparse_memory_present_with_active_regions(nid);
 77 }
 78 
 79 void __init __weak soc_mem_setup(void)
 80 {
 81 }
 82 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp