Commit 61167ad
mm: pass nid to reserve_bootmem_region()
early_pfn_to_nid() is called frequently in init_reserved_page(), it
returns the node id of the PFN. These PFN are probably from the same
memory region, they have the same node id. It's not necessary to call
early_pfn_to_nid() for each PFN.
Pass nid to reserve_bootmem_region() and drop the call to
early_pfn_to_nid() in init_reserved_page(). Also, set nid on all reserved
pages before doing this, as some reserved memory regions may not be set
nid.
The most beneficial function is memmap_init_reserved_pages() if
CONFIG_DEFERRED_STRUCT_PAGE_INIT is enabled.
The following data was tested on an x86 machine with 190GB of RAM.
before:
memmap_init_reserved_pages() 67ms
after:
memmap_init_reserved_pages() 20ms
Link: https://lkml.kernel.org/r/20230619023406.424298-1-yajun.deng@linux.dev
Signed-off-by: Yajun Deng <yajun.deng@linux.dev>
Reviewed-by: Mike Rapoport (IBM) <rppt@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>1 parent 9883c7f commit 61167ad
3 files changed
+40
-24
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2940 | 2940 | | |
2941 | 2941 | | |
2942 | 2942 | | |
2943 | | - | |
| 2943 | + | |
| 2944 | + | |
2944 | 2945 | | |
2945 | 2946 | | |
2946 | 2947 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2082 | 2082 | | |
2083 | 2083 | | |
2084 | 2084 | | |
2085 | | - | |
| 2085 | + | |
| 2086 | + | |
| 2087 | + | |
| 2088 | + | |
| 2089 | + | |
| 2090 | + | |
| 2091 | + | |
| 2092 | + | |
| 2093 | + | |
| 2094 | + | |
| 2095 | + | |
| 2096 | + | |
| 2097 | + | |
| 2098 | + | |
| 2099 | + | |
| 2100 | + | |
2086 | 2101 | | |
2087 | 2102 | | |
2088 | | - | |
2089 | | - | |
| 2103 | + | |
| 2104 | + | |
| 2105 | + | |
| 2106 | + | |
2090 | 2107 | | |
2091 | | - | |
2092 | | - | |
2093 | | - | |
2094 | | - | |
2095 | | - | |
2096 | | - | |
2097 | | - | |
| 2108 | + | |
2098 | 2109 | | |
2099 | 2110 | | |
2100 | 2111 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
646 | 646 | | |
647 | 647 | | |
648 | 648 | | |
649 | | - | |
| 649 | + | |
650 | 650 | | |
651 | | - | |
652 | | - | |
653 | 651 | | |
654 | 652 | | |
655 | 653 | | |
| |||
695 | 693 | | |
696 | 694 | | |
697 | 695 | | |
698 | | - | |
| 696 | + | |
699 | 697 | | |
700 | 698 | | |
701 | | - | |
| 699 | + | |
702 | 700 | | |
703 | | - | |
| 701 | + | |
704 | 702 | | |
705 | 703 | | |
706 | | - | |
707 | 704 | | |
708 | 705 | | |
709 | 706 | | |
| |||
717 | 714 | | |
718 | 715 | | |
719 | 716 | | |
720 | | - | |
| 717 | + | |
721 | 718 | | |
722 | 719 | | |
723 | 720 | | |
| |||
727 | 724 | | |
728 | 725 | | |
729 | 726 | | |
730 | | - | |
| 727 | + | |
731 | 728 | | |
732 | 729 | | |
733 | 730 | | |
| |||
738 | 735 | | |
739 | 736 | | |
740 | 737 | | |
741 | | - | |
| 738 | + | |
| 739 | + | |
742 | 740 | | |
743 | 741 | | |
744 | 742 | | |
| |||
747 | 745 | | |
748 | 746 | | |
749 | 747 | | |
750 | | - | |
| 748 | + | |
751 | 749 | | |
752 | 750 | | |
753 | 751 | | |
| |||
2572 | 2570 | | |
2573 | 2571 | | |
2574 | 2572 | | |
2575 | | - | |
2576 | | - | |
| 2573 | + | |
| 2574 | + | |
| 2575 | + | |
| 2576 | + | |
| 2577 | + | |
| 2578 | + | |
| 2579 | + | |
| 2580 | + | |
2577 | 2581 | | |
2578 | 2582 | | |
2579 | 2583 | | |
| |||
0 commit comments