Commit d0dc12e
mm/memory_hotplug: optimize memory hotplug
During memory hotplugging we traverse struct pages three times:
1. memset(0) in sparse_add_one_section()
2. loop in __add_section() to set do: set_page_node(page, nid); and
SetPageReserved(page);
3. loop in memmap_init_zone() to call __init_single_pfn()
This patch removes the first two loops, and leaves only loop 3. All
struct pages are initialized in one place, the same as it is done during
boot.
The benefits:
- We improve memory hotplug performance because we are not evicting the
cache several times and also reduce loop branching overhead.
- Remove condition from hotpath in __init_single_pfn(), that was added
in order to fix the problem that was reported by Bharata in the above
email thread, thus also improve performance during normal boot.
- Make memory hotplug more similar to the boot memory initialization
path because we zero and initialize struct pages only in one
function.
- Simplifies memory hotplug struct page initialization code, and thus
enables future improvements, such as multi-threading the
initialization of struct pages in order to improve hotplug
performance even further on larger machines.
[pasha.tatashin@oracle.com: v5]
Link: http://lkml.kernel.org/r/20180228030308.1116-7-pasha.tatashin@oracle.com
Link: http://lkml.kernel.org/r/20180215165920.8570-7-pasha.tatashin@oracle.com
Signed-off-by: Pavel Tatashin <pasha.tatashin@oracle.com>
Reviewed-by: Ingo Molnar <mingo@kernel.org>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Baoquan He <bhe@redhat.com>
Cc: Bharata B Rao <bharata@linux.vnet.ibm.com>
Cc: Daniel Jordan <daniel.m.jordan@oracle.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Mel Gorman <mgorman@techsingularity.net>
Cc: Steven Sistare <steven.sistare@oracle.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>1 parent fc44f7f commit d0dc12e
File tree
5 files changed
+28
-38
lines changed- drivers/base
- include/linux
- mm
5 files changed
+28
-38
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
407 | 407 | | |
408 | 408 | | |
409 | 409 | | |
| 410 | + | |
| 411 | + | |
410 | 412 | | |
411 | 413 | | |
412 | 414 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
36 | 37 | | |
37 | 38 | | |
38 | 39 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
250 | 250 | | |
251 | 251 | | |
252 | 252 | | |
253 | | - | |
254 | 253 | | |
255 | 254 | | |
256 | 255 | | |
| |||
259 | 258 | | |
260 | 259 | | |
261 | 260 | | |
262 | | - | |
263 | | - | |
264 | | - | |
265 | | - | |
266 | | - | |
267 | | - | |
268 | | - | |
269 | | - | |
270 | | - | |
271 | | - | |
272 | | - | |
273 | | - | |
274 | | - | |
275 | | - | |
276 | | - | |
277 | | - | |
278 | | - | |
279 | 261 | | |
280 | 262 | | |
281 | 263 | | |
| |||
908 | 890 | | |
909 | 891 | | |
910 | 892 | | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
911 | 901 | | |
912 | | - | |
913 | 902 | | |
914 | 903 | | |
915 | 904 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1143 | 1143 | | |
1144 | 1144 | | |
1145 | 1145 | | |
1146 | | - | |
| 1146 | + | |
1147 | 1147 | | |
1148 | | - | |
1149 | | - | |
| 1148 | + | |
1150 | 1149 | | |
1151 | 1150 | | |
1152 | 1151 | | |
| |||
1160 | 1159 | | |
1161 | 1160 | | |
1162 | 1161 | | |
1163 | | - | |
1164 | | - | |
1165 | | - | |
1166 | | - | |
1167 | | - | |
1168 | | - | |
1169 | 1162 | | |
1170 | 1163 | | |
1171 | 1164 | | |
| |||
1184 | 1177 | | |
1185 | 1178 | | |
1186 | 1179 | | |
1187 | | - | |
| 1180 | + | |
1188 | 1181 | | |
1189 | 1182 | | |
1190 | 1183 | | |
| |||
1501 | 1494 | | |
1502 | 1495 | | |
1503 | 1496 | | |
1504 | | - | |
| 1497 | + | |
1505 | 1498 | | |
1506 | 1499 | | |
1507 | 1500 | | |
| |||
5434 | 5427 | | |
5435 | 5428 | | |
5436 | 5429 | | |
| 5430 | + | |
5437 | 5431 | | |
5438 | 5432 | | |
5439 | 5433 | | |
| |||
5486 | 5480 | | |
5487 | 5481 | | |
5488 | 5482 | | |
| 5483 | + | |
| 5484 | + | |
| 5485 | + | |
| 5486 | + | |
| 5487 | + | |
5489 | 5488 | | |
5490 | 5489 | | |
5491 | 5490 | | |
| |||
5502 | 5501 | | |
5503 | 5502 | | |
5504 | 5503 | | |
5505 | | - | |
5506 | | - | |
5507 | | - | |
5508 | | - | |
5509 | 5504 | | |
5510 | 5505 | | |
5511 | | - | |
5512 | | - | |
5513 | | - | |
5514 | 5506 | | |
5515 | 5507 | | |
5516 | 5508 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
779 | 779 | | |
780 | 780 | | |
781 | 781 | | |
782 | | - | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
783 | 789 | | |
784 | 790 | | |
785 | 791 | | |
| |||
0 commit comments