[PATCH] percpu: Introduce DEFINE_PER_CPU_PAGE_ALIGNED()

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Andrew Morton <akpm@...>
Cc: linux kernel <linux-kernel@...>
Date: Thursday, May 15, 2008 - 3:37 am

While examining  percpu section on i386 I found we were wasting about 
8000 bytes
because of two large holes :

c05dd000 D __per_cpu_start
c05dd000 D per_cpu__current_task
c05dd004 D per_cpu__cpu_number
c05dd008 D per_cpu__irq_regs
c05dd00c D per_cpu__x86_cpu_to_apicid
c05dd010 d per_cpu__cpu_devices
c05dd044 D per_cpu__cyc2ns
*HOLE* of 4Kbytes
c05de000 d per_cpu__cpuid4_info
c05de004 d per_cpu__cache_kobject
c05de008 d per_cpu__index_kobject
*HOLE* of 4Kbytes
c05df000 D per_cpu__gdt_page
c05e0000 d per_cpu__next_check
c05e0008 d per_cpu__thermal_throttle_count

This is because gdt_page is a percpu variable, defined with a page 
alignement,
and linker is doing its job, two times because of .o nesting in the 
build process,
mixing variables with quite different alignment requirements.

I introduced a new macro DEFINE_PER_CPU_PAGE_ALIGNED() to avoid
wasting this space. All page aligned variables (only one at this time) 
are put in
a separate subsection .data.percpu.page_aligned.

# size -A vmlinux.old vmlinux | grep percpu
.data.percpu                22272   3227373568
.data.percpu                30336   3227373568

Thats 8064 bytes saved for each CPU (plus one for the .data.percpu 
storage itself)

Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] percpu: Introduce DEFINE_PER_CPU_PAGE_ALIGNED(), Eric Dumazet, (Thu May 15, 3:37 am)