Skip to contentSkip to conversation

Put modules into linear mapping

PATCH Andi Kleen 2 participants 6 messages Sep 27, 2002 2 messages not in the archive

lore
Share & tools
lore

Andi Kleen

author
#2 lore raw
In reply to a message not in the archive
Quoted 2 lines · Roman Zippel

Why is i386 only? This is generic code and other archs will benefit from it as well (or at least it won't hurt).

Because some arcitectures have a different module_map() (e.g. x86-64 or sparc64) and because the VMALLOC_START/END trick doesn't work on all.

Quoted 9 lines

Review

Quoted 7 lines
(quoted diff) +7 -0
+
+void *alloc_exact(unsigned int size)
+{
+	struct page *p, *w;
+	int order = get_order(size);
+
+	p = alloc_pages(GFP_KERNEL, order);

Wouldn't it be better to add a gfp argument?

I don't see a need for it. GFP_ATOMIC doesn't make sense for > order 0, and > order 0 is the only case that is interesting for alloc_exact. GFP_DMA is not needed here, and GFP_HIGHUSER neither supports > order 0 properly (because of kmap)

-Andi

#3 lore raw

Hi,

Quoted 5 lines · Andi Kleen
Quoted 2 lines

Why is i386 only? This is generic code and other archs will benefit from it as well (or at least it won't hurt).

Because some arcitectures have a different module_map() (e.g. x86-64 or sparc64)

As I already said in the last mail, these functions look like vmalloc reimplementations.

Quoted 1 line

and because the VMALLOC_START/END trick doesn't work on all.

Where doesn't it work? vmalloc wouldn't work there either.

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

+void *alloc_exact(unsigned int size)

Wouldn't it be better to add a gfp argument?

I don't see a need for it. GFP_ATOMIC doesn't make sense for > order 0, and > order 0 is the only case that is interesting for alloc_exact. GFP_DMA is not needed here, and GFP_HIGHUSER neither supports > order 0 properly (because of kmap)

If it's supposed to be a generic function, it makes sense, otherwise we could just put it into module.c.

bye, Roman

author
#4 lore raw
Quoted 4 lines · Roman Zippel

Hi,

On 27 Sep 2002, Andi Kleen wrote:

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Why is i386 only? This is generic code and other archs will benefit from it as well (or at least it won't hurt).

Because some arcitectures have a different module_map() (e.g. x86-64 or sparc64)

As I already said in the last mail, these functions look like vmalloc reimplementations.

No, they aren't. x86-64 uses it because modules need to be in 32bit range from the main kernel and vmalloc is in a different area. I suspect it is the same on sparc64.

Quoted 6 lines
Quoted 3 lines

and > order 0 is the only case that is interesting for alloc_exact. GFP_DMA is not needed here, and GFP_HIGHUSER neither supports > order 0 properly (because of kmap)

If it's supposed to be a generic function, it makes sense, otherwise we could just put it into module.c.

Ok, I will change it.

-Andi

#5 lore raw

Hi,

Quoted 3 lines · Andi Kleen

No, they aren't. x86-64 uses it because modules need to be in 32bit range from the main kernel and vmalloc is in a different area. I suspect it is the same on sparc64.

Ok, makes sense.

Quoted 4 lines
Quoted 2 lines

If it's supposed to be a generic function, it makes sense, otherwise we could just put it into module.c.

Ok, I will change it.

Any chance to use __HAVE_MODULE_MAP, so every arch (except sparc64/x86-64) can automatically benefit from this?

bye, Roman

author
#6 lore raw
Quoted 7 lines · Roman Zippel
Quoted 4 lines
Quoted 2 lines

If it's supposed to be a generic function, it makes sense, otherwise we could just put it into module.c.

Ok, I will change it.

Any chance to use __HAVE_MODULE_MAP, so every arch (except sparc64/x86-64) can automatically benefit from this?

I can put it in asm-generic/

But people have to check themselves if the vmalloc trick works for them.

-Andi

#7 lore raw

Hi,

Quoted 6 lines · Andi Kleen
Quoted 2 lines

Any chance to use __HAVE_MODULE_MAP, so every arch (except sparc64/x86-64) can automatically benefit from this?

I can put it in asm-generic/

But people have to check themselves if the vmalloc trick works for them.

If it's in module.c anyway, you could set a flag in mod->flags, at how it was allocated.

bye, Roman