Re: [PATCH 1/2]percpu: introduce read mostly percpu API

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Eric Dumazet
Date: Tuesday, October 19, 2010 - 10:18 pm

Le mercredi 20 octobre 2010 à 11:07 +0800, Shaohua Li a écrit :


Could you precisely describe why grouping together read mostly percpu
variables is a win ? Especially when you add in your next patch a single
variable ?


So percpu..page_aligned is not any more aligned to a PAGE ? or we have a
big hole before it ? Hmm....

Maybe you should put first data..percpu..page_aligned, then align to one
cache line (L1_CACHE_BYTES), then data..percpu..readmostly, so that hole
is small.

We should take care of not introducing too much holes in percpu zone.
Maybe using a new subzone ".data..percpu..small_objects" to put small
objects in it.

nm -v vmlinux | grep -10 sockets_in_use   # select one random part 

0000000000011e0c d cpu_min_freq
0000000000011e10 d cpu_cur_freq
0000000000011e14 d cpu_set_freq
0000000000011e18 d cpu_is_managed
0000000000011e20 d od_cpu_dbs_info
0000000000011fa0 d cs_cpu_dbs_info
00000000000120f0 d cpufreq_show_table
0000000000012100 D cpuidle_devices
0000000000012120 d ladder_devices
0000000000012200 d menu_devices       
00000000000122c0 d sockets_in_use     # object_size = 4 , hole = 28bytes
00000000000122e0 d prot_inuse         
00000000000123e0 D nf_conntrack_untracked
0000000000012560 d rt_cache_stat
00000000000125a0 d ipv4_cookie_scratch
0000000000012740 D init_tss
0000000000014a00 D irq_stat
0000000000014a40 D cpu_info
0000000000014b00 d hv_clock
0000000000014b40 D cpu_tlbstate
0000000000014b80 d runqueues

We can see many holes because of 2^5 alignments of
individual .o  .data..percpu sections.

find . -name "*.o"|xargs objdump -h|grep percpu

Linker promotes a section alignment from natural alignment to 2^5 as
soon as the size reaches 2^5

For example in net/ipv4/route.o, we have a per_cpu structure
(rt_cache_stat), that is an array of 16 integers. The natural alignement
should be 4 (alignof(int)), but we get :

# objdump -h net/ipv4/route.o|grep percpu
 19 .data..percpu 00000040  0000000000000000  0000000000000000  00007a80  2**5

For a section replicated N times, this really is a concern.

Thanks !


--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 1/2]percpu: introduce read mostly percpu API, Shaohua Li, (Tue Oct 19, 8:07 pm)
Re: [PATCH 1/2]percpu: introduce read mostly percpu API, Eric Dumazet, (Tue Oct 19, 10:18 pm)
Re: [PATCH 1/2]percpu: introduce read mostly percpu API, H. Peter Anvin, (Tue Oct 19, 11:00 pm)
Re: [PATCH 1/2]percpu: introduce read mostly percpu API, Eric Dumazet, (Wed Oct 20, 12:53 am)
Re: [PATCH 1/2]percpu: introduce read mostly percpu API, H. Peter Anvin, (Wed Oct 20, 2:33 pm)
Re: [PATCH 1/2]percpu: introduce read mostly percpu API, H. Peter Anvin, (Wed Oct 20, 2:38 pm)
Re: [PATCH 1/2]percpu: introduce read mostly percpu API, H. Peter Anvin, (Wed Oct 20, 2:42 pm)
[tip:x86/mm] percpu: Introduce a read-mostly percpu API, tip-bot for Shaohua Li, (Wed Oct 20, 4:06 pm)
Re: [tip:x86/mm] percpu: Introduce a read-mostly percpu API, H. Peter Anvin, (Wed Oct 20, 10:54 pm)
Re: [tip:x86/mm] percpu: Introduce a read-mostly percpu API, H. Peter Anvin, (Wed Oct 20, 11:09 pm)
Re: [tip:x86/mm] percpu: Introduce a read-mostly percpu API, H. Peter Anvin, (Wed Oct 20, 11:10 pm)
Re: [tip:x86/mm] percpu: Introduce a read-mostly percpu API, H. Peter Anvin, (Wed Oct 20, 11:54 pm)
[tip:x86/mm] x86-32, percpu: Correct the ordering of the p ..., tip-bot for H. Peter ..., (Thu Oct 21, 12:40 am)