Commit 8d40091
x86/vmemmap: handle unpopulated sub-pmd ranges
When sizeof(struct page) is not a power of 2, sections do not span a PMD
anymore and so when populating them some parts of the PMD will remain
unused.
Because of this, PMDs will be left behind when depopulating sections since
remove_pmd_table() thinks that those unused parts are still in use.
Fix this by marking the unused parts with PAGE_UNUSED, so memchr_inv()
will do the right thing and will let us free the PMD when the last user of
it is gone.
This patch is based on a similar patch by David Hildenbrand:
https://lore.kernel.org/linux-mm/[email protected]/
[[email protected]: go back to the ifdef version]
Link: https://lkml.kernel.org/r/[email protected]
Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Oscar Salvador <[email protected]>
Reviewed-by: David Hildenbrand <[email protected]>
Acked-by: Dave Hansen <[email protected]>
Cc: Andy Lutomirski <[email protected]>
Cc: Borislav Petkov <[email protected]>
Cc: "H . Peter Anvin" <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Michal Hocko <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Zi Yan <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>1 parent 69ccfe7 commit 8d40091
1 file changed
Lines changed: 55 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
826 | 826 | | |
827 | 827 | | |
828 | 828 | | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
829 | 874 | | |
830 | 875 | | |
831 | 876 | | |
| |||
871 | 916 | | |
872 | 917 | | |
873 | 918 | | |
874 | | - | |
875 | | - | |
876 | 919 | | |
877 | 920 | | |
878 | 921 | | |
| |||
1006 | 1049 | | |
1007 | 1050 | | |
1008 | 1051 | | |
1009 | | - | |
1010 | 1052 | | |
1011 | 1053 | | |
1012 | 1054 | | |
| |||
1026 | 1068 | | |
1027 | 1069 | | |
1028 | 1070 | | |
1029 | | - | |
1030 | | - | |
1031 | | - | |
1032 | | - | |
1033 | | - | |
1034 | | - | |
1035 | | - | |
| 1071 | + | |
| 1072 | + | |
| 1073 | + | |
1036 | 1074 | | |
1037 | 1075 | | |
1038 | | - | |
1039 | 1076 | | |
1040 | 1077 | | |
1041 | 1078 | | |
1042 | | - | |
1043 | 1079 | | |
1044 | | - | |
| 1080 | + | |
1045 | 1081 | | |
1046 | 1082 | | |
1047 | 1083 | | |
| |||
1492 | 1528 | | |
1493 | 1529 | | |
1494 | 1530 | | |
| 1531 | + | |
| 1532 | + | |
| 1533 | + | |
| 1534 | + | |
| 1535 | + | |
1495 | 1536 | | |
1496 | 1537 | | |
1497 | 1538 | | |
1498 | 1539 | | |
1499 | 1540 | | |
| 1541 | + | |
1500 | 1542 | | |
1501 | 1543 | | |
1502 | 1544 | | |
| |||
0 commit comments