/[linux-patches]/genpatches-2.6/tags/2.6.12-12/1910_percpu-modalloc.patch
Gentoo

Contents of /genpatches-2.6/tags/2.6.12-12/1910_percpu-modalloc.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 137 - (show annotations) (download)
Tue Aug 9 21:23:12 2005 UTC (12 years, 10 months ago) by dsd
File size: 2465 byte(s)
2.6.12-12 release
1 From: Rusty Russell <rusty@rustcorp.com.au>
2 Date: Tue, 2 Aug 2005 04:11:47 +0000 (-0700)
3 Subject: [PATCH] Module per-cpu alignment cannot always be met
4 X-Git-Tag: v2.6.13-rc5
5 X-Git-Url: http://www.kernel.org/git/gitweb.cgi?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=842bbaaa7394820c8f1fe0629cd15478653caf86
6
7 [PATCH] Module per-cpu alignment cannot always be met
8
9 The module code assumes noone will ever ask for a per-cpu area more than
10 SMP_CACHE_BYTES aligned. However, as these cases show, gcc asks sometimes
11 asks for 32-byte alignment for the per-cpu section on a module, and if
12 CONFIG_X86_L1_CACHE_SHIFT is 4, we hit that BUG_ON(). This is obviously an
13 unusual combination, as there have been few reports, but better to warn
14 than die.
15
16 See:
17 http://www.ussg.iu.edu/hypermail/linux/kernel/0409.0/0768.html
18
19 And more recently:
20 http://bugs.gentoo.org/show_bug.cgi?id=97006
21
22 Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
23 Signed-off-by: Andrew Morton <akpm@osdl.org>
24 Signed-off-by: Linus Torvalds <torvalds@osdl.org>
25 ---
26
27 --- a/kernel/module.c
28 +++ b/kernel/module.c
29 @@ -250,13 +250,18 @@ static inline unsigned int block_size(in
30 /* Created by linker magic */
31 extern char __per_cpu_start[], __per_cpu_end[];
32
33 -static void *percpu_modalloc(unsigned long size, unsigned long align)
34 +static void *percpu_modalloc(unsigned long size, unsigned long align,
35 + const char *name)
36 {
37 unsigned long extra;
38 unsigned int i;
39 void *ptr;
40
41 - BUG_ON(align > SMP_CACHE_BYTES);
42 + if (align > SMP_CACHE_BYTES) {
43 + printk(KERN_WARNING "%s: per-cpu alignment %li > %i\n",
44 + name, align, SMP_CACHE_BYTES);
45 + align = SMP_CACHE_BYTES;
46 + }
47
48 ptr = __per_cpu_start;
49 for (i = 0; i < pcpu_num_used; ptr += block_size(pcpu_size[i]), i++) {
50 @@ -348,7 +353,8 @@ static int percpu_modinit(void)
51 }
52 __initcall(percpu_modinit);
53 #else /* ... !CONFIG_SMP */
54 -static inline void *percpu_modalloc(unsigned long size, unsigned long align)
55 +static inline void *percpu_modalloc(unsigned long size, unsigned long align,
56 + const char *name)
57 {
58 return NULL;
59 }
60 @@ -1644,7 +1650,8 @@ static struct module *load_module(void _
61 if (pcpuindex) {
62 /* We have a special allocation for this section. */
63 percpu = percpu_modalloc(sechdrs[pcpuindex].sh_size,
64 - sechdrs[pcpuindex].sh_addralign);
65 + sechdrs[pcpuindex].sh_addralign,
66 + mod->name);
67 if (!percpu) {
68 err = -ENOMEM;
69 goto free_mod;

  ViewVC Help
Powered by ViewVC 1.1.20