Re: [PATCH v2 0/8] sparc: use asm-generic/dma-mapping-common.h andpci-dma-compat.h

From: Ingo Molnar
Date: Mon Aug 03 2009 - 01:55:28 EST



* David Miller <davem@xxxxxxxxxxxxx> wrote:

> From: Ingo Molnar <mingo@xxxxxxx>
> Date: Sat, 18 Jul 2009 13:06:20 +0200
>
> > I'm wondering why sparc32 frees from the middle of the kernel
> > image. The way architectures generally do it is to put freeable
> > pages into a separate section. That way it does not get mingled
> > with the kernel core image area (which stays nicely continuous).
>
> It's conditionally free'able, we actually use the pages if the
> system is SMP and has more than cpu 0 installed.

Sounds similar to the alternate instructions section on x86:

arch/x86/kernel/alternative.c:

if (smp_alt_once)
free_init_pages("SMP alternatives",
(unsigned long)__smp_locks,
(unsigned long)__smp_locks_end);

It's in a separate section and linked + freed separately. The linker
script page-aligns it:

arch/x86/kernel/vmlinux.lds.S:

/*
* smp_locks might be freed after init
* start/end must be page aligned
*/
. = ALIGN(PAGE_SIZE);
.smp_locks : AT(ADDR(.smp_locks) - LOAD_OFFSET) {
__smp_locks = .;
*(.smp_locks)
__smp_locks_end = .;
. = ALIGN(PAGE_SIZE);
}

So that it can be freed. It's also placed next to the regular init
section to not create too many holes. It also keeps the 'kernel text
area' continuous and things like core_kernel_text() & co still work
fine.

Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/