Commit c357688
mm: fix accounting of memmap pages
For !CONFIG_SPARSEMEM_VMEMMAP, memmap page accounting is currently done
upfront in sparse_buffer_init(). However, sparse_buffer_alloc() may
return NULL in failure scenario.
Also, memmap pages may be allocated either from the memblock allocator
during early boot or from the buddy allocator. When removed via
arch_remove_memory(), accounting of memmap pages must reflect the original
allocation source.
To ensure correctness:
* Account memmap pages after successful allocation in sparse_init_nid()
and section_activate().
* Account memmap pages in section_deactivate() based on allocation
source.
Link: https://lkml.kernel.org/r/[email protected]
Fixes: 15995a3 ("mm: report per-page metadata information")
Signed-off-by: Sumanth Korikkar <[email protected]>
Suggested-by: David Hildenbrand <[email protected]>
Reviewed-by: Wei Yang <[email protected]>
Cc: Alexander Gordeev <[email protected]>
Cc: Gerald Schaefer <[email protected]>
Cc: Heiko Carstens <[email protected]>
Cc: Vasily Gorbik <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>1 parent 9f68eab commit c357688
2 files changed
+9
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
578 | 578 | | |
579 | 579 | | |
580 | 580 | | |
581 | | - | |
582 | | - | |
583 | | - | |
584 | | - | |
585 | | - | |
586 | 581 | | |
587 | 582 | | |
588 | 583 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
454 | 454 | | |
455 | 455 | | |
456 | 456 | | |
457 | | - | |
458 | | - | |
459 | | - | |
460 | 457 | | |
461 | 458 | | |
462 | 459 | | |
| |||
567 | 564 | | |
568 | 565 | | |
569 | 566 | | |
| 567 | + | |
| 568 | + | |
570 | 569 | | |
571 | 570 | | |
572 | 571 | | |
| |||
680 | 679 | | |
681 | 680 | | |
682 | 681 | | |
683 | | - | |
684 | 682 | | |
685 | 683 | | |
686 | 684 | | |
| |||
856 | 854 | | |
857 | 855 | | |
858 | 856 | | |
859 | | - | |
| 857 | + | |
| 858 | + | |
860 | 859 | | |
861 | | - | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
862 | 863 | | |
| 864 | + | |
863 | 865 | | |
864 | 866 | | |
865 | 867 | | |
| |||
904 | 906 | | |
905 | 907 | | |
906 | 908 | | |
| 909 | + | |
907 | 910 | | |
908 | 911 | | |
909 | 912 | | |
| |||
0 commit comments