Conflicts: arch/parisc/kernel/irq.c arch/x86/include/asm/fixmap_64.h arch/x86/include/asm/setup.h kernel/irq/handle.c Semantic merge: arch/x86/include/asm/fixmap.h
Showing the changes to kernel/module.c (1 of 465 files). Show all
Unified · Split
| @@ -51,6 +51,7 @@ · 50 unmodified lines | ||
| 51 | 51 | #include <linux/tracepoint.h> |
| 52 | 52 | #include <linux/ftrace.h> |
| 53 | 53 | #include <linux/async.h> |
| 54 | +#include <linux/percpu.h> | |
| 54 | 55 | |
| 55 | 56 | #if 0 |
| 56 | 57 | #define DEBUGP printk |
| @@ -366,6 +367,34 @@ static struct module *find_module(const char *name) · 309 unmodified lines | ||
| 366 | 367 | } |
| 367 | 368 | |
| 368 | 369 | #ifdef CONFIG_SMP |
| 370 | + | |
| 371 | +#ifdef CONFIG_HAVE_DYNAMIC_PER_CPU_AREA | |
| 372 | + | |
| 373 | +static void *percpu_modalloc(unsigned long size, unsigned long align, | |
| 374 | + const char *name) | |
| 375 | +{ | |
| 376 | + void *ptr; | |
| 377 | + | |
| 378 | + if (align > PAGE_SIZE) { | |
| 379 | + printk(KERN_WARNING "%s: per-cpu alignment %li > %li\n", | |
| 380 | + name, align, PAGE_SIZE); | |
| 381 | + align = PAGE_SIZE; | |
| 382 | + } | |
| 383 | + | |
| 384 | + ptr = __alloc_reserved_percpu(size, align); | |
| 385 | + if (!ptr) | |
| 386 | + printk(KERN_WARNING | |
| 387 | + "Could not allocate %lu bytes percpu data\n", size); | |
| 388 | + return ptr; | |
| 389 | +} | |
| 390 | + | |
| 391 | +static void percpu_modfree(void *freeme) | |
| 392 | +{ | |
| 393 | + free_percpu(freeme); | |
| 394 | +} | |
| 395 | + | |
| 396 | +#else /* ... !CONFIG_HAVE_DYNAMIC_PER_CPU_AREA */ | |
| 397 | + | |
| 369 | 398 | /* Number of blocks used and allocated. */ |
| 370 | 399 | static unsigned int pcpu_num_used, pcpu_num_allocated; |
| 371 | 400 | /* Size of each block. -ve means used. */ |
| @@ -480,21 +509,6 @@ static void percpu_modfree(void *freeme) · 108 unmodified lines | ||
| 480 | 509 | } |
| 481 | 510 | } |
| 482 | 511 | |
| 483 | −static unsigned int find_pcpusec(Elf_Ehdr *hdr, | |
| 484 | − Elf_Shdr *sechdrs, | |
| 485 | − const char *secstrings) | |
| 486 | −{ | |
| 487 | − return find_sec(hdr, sechdrs, secstrings, ".data.percpu"); | |
| 488 | −} | |
| 489 | − | |
| 490 | −static void percpu_modcopy(void *pcpudest, const void *from, unsigned long size) | |
| 491 | −{ | |
| 492 | − int cpu; | |
| 493 | − | |
| 494 | − for_each_possible_cpu(cpu) | |
| 495 | − memcpy(pcpudest + per_cpu_offset(cpu), from, size); | |
| 496 | −} | |
| 497 | − | |
| 498 | 512 | static int percpu_modinit(void) |
| 499 | 513 | { |
| 500 | 514 | pcpu_num_used = 2; |
| @@ -513,7 +527,26 @@ static int percpu_modinit(void) · 12 unmodified lines | ||
| 513 | 527 | return 0; |
| 514 | 528 | } |
| 515 | 529 | __initcall(percpu_modinit); |
| 530 | + | |
| 531 | +#endif /* CONFIG_HAVE_DYNAMIC_PER_CPU_AREA */ | |
| 532 | + | |
| 533 | +static unsigned int find_pcpusec(Elf_Ehdr *hdr, | |
| 534 | + Elf_Shdr *sechdrs, | |
| 535 | + const char *secstrings) | |
| 536 | +{ | |
| 537 | + return find_sec(hdr, sechdrs, secstrings, ".data.percpu"); | |
| 538 | +} | |
| 539 | + | |
| 540 | +static void percpu_modcopy(void *pcpudest, const void *from, unsigned long size) | |
| 541 | +{ | |
| 542 | + int cpu; | |
| 543 | + | |
| 544 | + for_each_possible_cpu(cpu) | |
| 545 | + memcpy(pcpudest + per_cpu_offset(cpu), from, size); | |
| 546 | +} | |
| 547 | + | |
| 516 | 548 | #else /* ... !CONFIG_SMP */ |
| 549 | + | |
| 517 | 550 | static inline void *percpu_modalloc(unsigned long size, unsigned long align, |
| 518 | 551 | const char *name) |
| 519 | 552 | { |
| @@ -535,6 +568,7 @@ static inline void percpu_modcopy(void *pcpudst, const void *src, · 15 unmodified lines | ||
| 535 | 568 | /* pcpusec should be 0, and size of that section should be 0. */ |
| 536 | 569 | BUG_ON(size != 0); |
| 537 | 570 | } |
| 571 | + | |
| 538 | 572 | #endif /* CONFIG_SMP */ |
| 539 | 573 | |
| 540 | 574 | #define MODINFO_ATTR(field) \ |