kernel-hacking-2024-linux-s.../arch
Russ Anderson 7c243c7168 mm: speedup in __early_pfn_to_nid
When booting on a large memory system, the kernel spends considerable
time in memmap_init_zone() setting up memory zones.  Analysis shows
significant time spent in __early_pfn_to_nid().

The routine memmap_init_zone() checks each PFN to verify the nid is
valid.  __early_pfn_to_nid() sequentially scans the list of pfn ranges
to find the right range and returns the nid.  This does not scale well.
On a 4 TB (single rack) system there are 308 memory ranges to scan.  The
higher the PFN the more time spent sequentially spinning through memory
ranges.

Since memmap_init_zone() increments pfn, it will almost always be
looking for the same range as the previous pfn, so check that range
first.  If it is in the same range, return that nid.  If not, scan the
list as before.

A 4 TB (single rack) UV1 system takes 512 seconds to get through the
zone code.  This performance optimization reduces the time by 189
seconds, a 36% improvement.

A 2 TB (single rack) UV2 system goes from 212.7 seconds to 99.8 seconds,
a 112.9 second (53%) reduction.

[akpm@linux-foundation.org: make the statics __meminitdata]
[akpm@linux-foundation.org: fix comment formatting]
[akpm@linux-foundation.org: fix ia64, per yinghai]
[akpm@linux-foundation.org: add missing semicolon, per Tony]
Signed-off-by: Russ Anderson <rja@sgi.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Tested-by: "Luck, Tony" <tony.luck@intel.com>
Cc: Yinghai Lu <yinghai@kernel.org>
Cc: Lin Feng <linfeng@cn.fujitsu.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-04-29 15:54:35 -07:00
..
alpha mm/alpha: use common help functions to free reserved pages 2013-04-29 15:54:29 -07:00
arc mm/arc: use common help functions to free reserved pages 2013-04-29 15:54:31 -07:00
arm arm: set the page table freeing ceiling to TASK_SIZE 2013-04-29 15:54:34 -07:00
arm64 sparse-vmemmap: specify vmemmap population range in bytes 2013-04-29 15:54:35 -07:00
avr32 mm/avr32: use common help functions to free reserved pages 2013-04-29 15:54:29 -07:00
blackfin mm/blackfin: use common help functions to free reserved pages 2013-04-29 15:54:29 -07:00
c6x mm/c6x: use common help functions to free reserved pages 2013-04-29 15:54:29 -07:00
cris mm/cris: use common help functions to free reserved pages 2013-04-29 15:54:29 -07:00
frv mm/FRV: use free_highmem_page() to free highmem pages into buddy system 2013-04-29 15:54:32 -07:00
h8300 mm/h8300: use common help functions to free reserved pages 2013-04-29 15:54:29 -07:00
hexagon
ia64 mm: speedup in __early_pfn_to_nid 2013-04-29 15:54:35 -07:00
m32r mm/m32r: use common help functions to free reserved pages 2013-04-29 15:54:30 -07:00
m68k mm/m68k: use common help functions to free reserved pages 2013-04-29 15:54:30 -07:00
metag mm/metag: use free_highmem_page() to free highmem pages into buddy system 2013-04-29 15:54:32 -07:00
microblaze mm/microblaze: use free_highmem_page() to free highmem pages into buddy system 2013-04-29 15:54:32 -07:00
mips mm/hugetlb: add more arch-defined huge_pte functions 2013-04-29 15:54:33 -07:00
mn10300 mm/mn10300: use common help functions to free reserved pages 2013-04-29 15:54:30 -07:00
openrisc mm/openrisc: use common help functions to free reserved pages 2013-04-29 15:54:30 -07:00
parisc mm/parisc: use common help functions to free reserved pages 2013-04-29 15:54:30 -07:00
powerpc sparse-vmemmap: specify vmemmap population range in bytes 2013-04-29 15:54:35 -07:00
s390 sparse-vmemmap: specify vmemmap population range in bytes 2013-04-29 15:54:35 -07:00
score mm/score: use common help functions to free reserved pages 2013-04-29 15:54:31 -07:00
sh mm/hugetlb: add more arch-defined huge_pte functions 2013-04-29 15:54:33 -07:00
sparc sparse-vmemmap: specify vmemmap population range in bytes 2013-04-29 15:54:35 -07:00
tile mm, vmalloc: change iterating a vmlist to find_vm_area() 2013-04-29 15:54:33 -07:00
um mm/um: use free_highmem_page() to free highmem pages into buddy system 2013-04-29 15:54:32 -07:00
unicore32 mm, vmalloc: change iterating a vmlist to find_vm_area() 2013-04-29 15:54:33 -07:00
x86 x86-64: fall back to regular page vmemmap on allocation failure 2013-04-29 15:54:35 -07:00
xtensa mm/xtensa: use common help functions to free reserved pages 2013-04-29 15:54:31 -07:00
.gitignore
Kconfig