diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-09-15 12:39:44 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-09-15 12:39:44 -0400 |
commit | ada3fa15057205b7d3f727bba5cd26b5912e350f (patch) | |
tree | 60962fc9e4021b92f484d1a58e72cd3906d4f3db /arch/sparc | |
parent | 2f82af08fcc7dc01a7e98a49a5995a77e32a2925 (diff) | |
parent | 5579fd7e6aed8860ea0c8e3f11897493153b10ad (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu: (46 commits)
powerpc64: convert to dynamic percpu allocator
sparc64: use embedding percpu first chunk allocator
percpu: kill lpage first chunk allocator
x86,percpu: use embedding for 64bit NUMA and page for 32bit NUMA
percpu: update embedding first chunk allocator to handle sparse units
percpu: use group information to allocate vmap areas sparsely
vmalloc: implement pcpu_get_vm_areas()
vmalloc: separate out insert_vmalloc_vm()
percpu: add chunk->base_addr
percpu: add pcpu_unit_offsets[]
percpu: introduce pcpu_alloc_info and pcpu_group_info
percpu: move pcpu_lpage_build_unit_map() and pcpul_lpage_dump_cfg() upward
percpu: add @align to pcpu_fc_alloc_fn_t
percpu: make @dyn_size mandatory for pcpu_setup_first_chunk()
percpu: drop @static_size from first chunk allocators
percpu: generalize first chunk allocator selection
percpu: build first chunk allocators selectively
percpu: rename 4k first chunk allocator to page
percpu: improve boot messages
percpu: fix pcpu_reclaim() locking
...
Fix trivial conflict as by Tejun Heo in kernel/sched.c
Diffstat (limited to 'arch/sparc')
-rw-r--r-- | arch/sparc/Kconfig | 2 | ||||
-rw-r--r-- | arch/sparc/kernel/smp_64.c | 132 | ||||
-rw-r--r-- | arch/sparc/kernel/vmlinux.lds.S | 8 |
3 files changed, 23 insertions, 119 deletions
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig index 2bd5c287538a..86b82348b97c 100644 --- a/arch/sparc/Kconfig +++ b/arch/sparc/Kconfig | |||
@@ -99,7 +99,7 @@ config AUDIT_ARCH | |||
99 | config HAVE_SETUP_PER_CPU_AREA | 99 | config HAVE_SETUP_PER_CPU_AREA |
100 | def_bool y if SPARC64 | 100 | def_bool y if SPARC64 |
101 | 101 | ||
102 | config HAVE_DYNAMIC_PER_CPU_AREA | 102 | config NEED_PER_CPU_EMBED_FIRST_CHUNK |
103 | def_bool y if SPARC64 | 103 | def_bool y if SPARC64 |
104 | 104 | ||
105 | config GENERIC_HARDIRQS_NO__DO_IRQ | 105 | config GENERIC_HARDIRQS_NO__DO_IRQ |
diff --git a/arch/sparc/kernel/smp_64.c b/arch/sparc/kernel/smp_64.c index 3691907a43b4..ff68373ce6d6 100644 --- a/arch/sparc/kernel/smp_64.c +++ b/arch/sparc/kernel/smp_64.c | |||
@@ -1389,8 +1389,8 @@ void smp_send_stop(void) | |||
1389 | * RETURNS: | 1389 | * RETURNS: |
1390 | * Pointer to the allocated area on success, NULL on failure. | 1390 | * Pointer to the allocated area on success, NULL on failure. |
1391 | */ | 1391 | */ |
1392 | static void * __init pcpu_alloc_bootmem(unsigned int cpu, unsigned long size, | 1392 | static void * __init pcpu_alloc_bootmem(unsigned int cpu, size_t size, |
1393 | unsigned long align) | 1393 | size_t align) |
1394 | { | 1394 | { |
1395 | const unsigned long goal = __pa(MAX_DMA_ADDRESS); | 1395 | const unsigned long goal = __pa(MAX_DMA_ADDRESS); |
1396 | #ifdef CONFIG_NEED_MULTIPLE_NODES | 1396 | #ifdef CONFIG_NEED_MULTIPLE_NODES |
@@ -1415,127 +1415,35 @@ static void * __init pcpu_alloc_bootmem(unsigned int cpu, unsigned long size, | |||
1415 | #endif | 1415 | #endif |
1416 | } | 1416 | } |
1417 | 1417 | ||
1418 | static size_t pcpur_size __initdata; | 1418 | static void __init pcpu_free_bootmem(void *ptr, size_t size) |
1419 | static void **pcpur_ptrs __initdata; | ||
1420 | |||
1421 | static struct page * __init pcpur_get_page(unsigned int cpu, int pageno) | ||
1422 | { | 1419 | { |
1423 | size_t off = (size_t)pageno << PAGE_SHIFT; | 1420 | free_bootmem(__pa(ptr), size); |
1424 | |||
1425 | if (off >= pcpur_size) | ||
1426 | return NULL; | ||
1427 | |||
1428 | return virt_to_page(pcpur_ptrs[cpu] + off); | ||
1429 | } | 1421 | } |
1430 | 1422 | ||
1431 | #define PCPU_CHUNK_SIZE (4UL * 1024UL * 1024UL) | 1423 | static int pcpu_cpu_distance(unsigned int from, unsigned int to) |
1432 | |||
1433 | static void __init pcpu_map_range(unsigned long start, unsigned long end, | ||
1434 | struct page *page) | ||
1435 | { | 1424 | { |
1436 | unsigned long pfn = page_to_pfn(page); | 1425 | if (cpu_to_node(from) == cpu_to_node(to)) |
1437 | unsigned long pte_base; | 1426 | return LOCAL_DISTANCE; |
1438 | 1427 | else | |
1439 | BUG_ON((pfn<<PAGE_SHIFT)&(PCPU_CHUNK_SIZE - 1UL)); | 1428 | return REMOTE_DISTANCE; |
1440 | |||
1441 | pte_base = (_PAGE_VALID | _PAGE_SZ4MB_4U | | ||
1442 | _PAGE_CP_4U | _PAGE_CV_4U | | ||
1443 | _PAGE_P_4U | _PAGE_W_4U); | ||
1444 | if (tlb_type == hypervisor) | ||
1445 | pte_base = (_PAGE_VALID | _PAGE_SZ4MB_4V | | ||
1446 | _PAGE_CP_4V | _PAGE_CV_4V | | ||
1447 | _PAGE_P_4V | _PAGE_W_4V); | ||
1448 | |||
1449 | while (start < end) { | ||
1450 | pgd_t *pgd = pgd_offset_k(start); | ||
1451 | unsigned long this_end; | ||
1452 | pud_t *pud; | ||
1453 | pmd_t *pmd; | ||
1454 | pte_t *pte; | ||
1455 | |||
1456 | pud = pud_offset(pgd, start); | ||
1457 | if (pud_none(*pud)) { | ||
1458 | pmd_t *new; | ||
1459 | |||
1460 | new = __alloc_bootmem(PAGE_SIZE, PAGE_SIZE, PAGE_SIZE); | ||
1461 | pud_populate(&init_mm, pud, new); | ||
1462 | } | ||
1463 | |||
1464 | pmd = pmd_offset(pud, start); | ||
1465 | if (!pmd_present(*pmd)) { | ||
1466 | pte_t *new; | ||
1467 | |||
1468 | new = __alloc_bootmem(PAGE_SIZE, PAGE_SIZE, PAGE_SIZE); | ||
1469 | pmd_populate_kernel(&init_mm, pmd, new); | ||
1470 | } | ||
1471 | |||
1472 | pte = pte_offset_kernel(pmd, start); | ||
1473 | this_end = (start + PMD_SIZE) & PMD_MASK; | ||
1474 | if (this_end > end) | ||
1475 | this_end = end; | ||
1476 | |||
1477 | while (start < this_end) { | ||
1478 | unsigned long paddr = pfn << PAGE_SHIFT; | ||
1479 | |||
1480 | pte_val(*pte) = (paddr | pte_base); | ||
1481 | |||
1482 | start += PAGE_SIZE; | ||
1483 | pte++; | ||
1484 | pfn++; | ||
1485 | } | ||
1486 | } | ||
1487 | } | 1429 | } |
1488 | 1430 | ||
1489 | void __init setup_per_cpu_areas(void) | 1431 | void __init setup_per_cpu_areas(void) |
1490 | { | 1432 | { |
1491 | size_t dyn_size, static_size = __per_cpu_end - __per_cpu_start; | 1433 | unsigned long delta; |
1492 | static struct vm_struct vm; | 1434 | unsigned int cpu; |
1493 | unsigned long delta, cpu; | 1435 | int rc; |
1494 | size_t pcpu_unit_size; | ||
1495 | size_t ptrs_size; | ||
1496 | |||
1497 | pcpur_size = PFN_ALIGN(static_size + PERCPU_MODULE_RESERVE + | ||
1498 | PERCPU_DYNAMIC_RESERVE); | ||
1499 | dyn_size = pcpur_size - static_size - PERCPU_MODULE_RESERVE; | ||
1500 | |||
1501 | 1436 | ||
1502 | ptrs_size = PFN_ALIGN(nr_cpu_ids * sizeof(pcpur_ptrs[0])); | 1437 | rc = pcpu_embed_first_chunk(PERCPU_MODULE_RESERVE, |
1503 | pcpur_ptrs = alloc_bootmem(ptrs_size); | 1438 | PERCPU_DYNAMIC_RESERVE, 4 << 20, |
1504 | 1439 | pcpu_cpu_distance, pcpu_alloc_bootmem, | |
1505 | for_each_possible_cpu(cpu) { | 1440 | pcpu_free_bootmem); |
1506 | pcpur_ptrs[cpu] = pcpu_alloc_bootmem(cpu, PCPU_CHUNK_SIZE, | 1441 | if (rc) |
1507 | PCPU_CHUNK_SIZE); | 1442 | panic("failed to initialize first chunk (%d)", rc); |
1508 | |||
1509 | free_bootmem(__pa(pcpur_ptrs[cpu] + pcpur_size), | ||
1510 | PCPU_CHUNK_SIZE - pcpur_size); | ||
1511 | |||
1512 | memcpy(pcpur_ptrs[cpu], __per_cpu_load, static_size); | ||
1513 | } | ||
1514 | |||
1515 | /* allocate address and map */ | ||
1516 | vm.flags = VM_ALLOC; | ||
1517 | vm.size = nr_cpu_ids * PCPU_CHUNK_SIZE; | ||
1518 | vm_area_register_early(&vm, PCPU_CHUNK_SIZE); | ||
1519 | |||
1520 | for_each_possible_cpu(cpu) { | ||
1521 | unsigned long start = (unsigned long) vm.addr; | ||
1522 | unsigned long end; | ||
1523 | |||
1524 | start += cpu * PCPU_CHUNK_SIZE; | ||
1525 | end = start + PCPU_CHUNK_SIZE; | ||
1526 | pcpu_map_range(start, end, virt_to_page(pcpur_ptrs[cpu])); | ||
1527 | } | ||
1528 | |||
1529 | pcpu_unit_size = pcpu_setup_first_chunk(pcpur_get_page, static_size, | ||
1530 | PERCPU_MODULE_RESERVE, dyn_size, | ||
1531 | PCPU_CHUNK_SIZE, vm.addr, NULL); | ||
1532 | |||
1533 | free_bootmem(__pa(pcpur_ptrs), ptrs_size); | ||
1534 | 1443 | ||
1535 | delta = (unsigned long)pcpu_base_addr - (unsigned long)__per_cpu_start; | 1444 | delta = (unsigned long)pcpu_base_addr - (unsigned long)__per_cpu_start; |
1536 | for_each_possible_cpu(cpu) { | 1445 | for_each_possible_cpu(cpu) |
1537 | __per_cpu_offset(cpu) = delta + cpu * pcpu_unit_size; | 1446 | __per_cpu_offset(cpu) = delta + pcpu_unit_offsets[cpu]; |
1538 | } | ||
1539 | 1447 | ||
1540 | /* Setup %g5 for the boot cpu. */ | 1448 | /* Setup %g5 for the boot cpu. */ |
1541 | __local_per_cpu_offset = __per_cpu_offset(smp_processor_id()); | 1449 | __local_per_cpu_offset = __per_cpu_offset(smp_processor_id()); |
diff --git a/arch/sparc/kernel/vmlinux.lds.S b/arch/sparc/kernel/vmlinux.lds.S index fcbbd000ec08..866390feb683 100644 --- a/arch/sparc/kernel/vmlinux.lds.S +++ b/arch/sparc/kernel/vmlinux.lds.S | |||
@@ -171,12 +171,8 @@ SECTIONS | |||
171 | } | 171 | } |
172 | _end = . ; | 172 | _end = . ; |
173 | 173 | ||
174 | /DISCARD/ : { | ||
175 | EXIT_TEXT | ||
176 | EXIT_DATA | ||
177 | *(.exitcall.exit) | ||
178 | } | ||
179 | |||
180 | STABS_DEBUG | 174 | STABS_DEBUG |
181 | DWARF_DEBUG | 175 | DWARF_DEBUG |
176 | |||
177 | DISCARDS | ||
182 | } | 178 | } |