Commit d8ea7cc
mm/khugepaged: add flag to predicate khugepaged-only behavior
Add .is_khugepaged flag to struct collapse_control so khugepaged-specific
behavior can be elided by MADV_COLLAPSE context.
Start by protecting khugepaged-specific heuristics by this flag. In
MADV_COLLAPSE, the user presumably has reason to believe the collapse will
be beneficial and khugepaged heuristics shouldn't prevent the user from
doing so:
1) sysfs-controlled knobs khugepaged_max_ptes_[none|swap|shared]
2) requirement that some pages in region being collapsed be young or
referenced
[zokeefe@google.com: consistently order cc->is_khugepaged and pte_* checks]
Link: https://lkml.kernel.org/r/20220720140603.1958773-3-zokeefe@google.com
Link: https://lore.kernel.org/linux-mm/Ys2qJm6FaOQcxkha@google.com/
Link: https://lkml.kernel.org/r/20220706235936.2197195-7-zokeefe@google.com
Signed-off-by: Zach O'Keefe <zokeefe@google.com>
Reviewed-by: Yang Shi <shy828301@gmail.com>
Cc: Alex Shi <alex.shi@linux.alibaba.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Axel Rasmussen <axelrasmussen@google.com>
Cc: Chris Kennelly <ckennelly@google.com>
Cc: Chris Zankel <chris@zankel.net>
Cc: David Hildenbrand <david@redhat.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Helge Deller <deller@gmx.de>
Cc: Hugh Dickins <hughd@google.com>
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Matt Turner <mattst88@gmail.com>
Cc: Max Filippov <jcmvbkbc@gmail.com>
Cc: Miaohe Lin <linmiaohe@huawei.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Pasha Tatashin <pasha.tatashin@soleen.com>
Cc: Pavel Begunkov <asml.silence@gmail.com>
Cc: Peter Xu <peterx@redhat.com>
Cc: Rongwei Wang <rongwei.wang@linux.alibaba.com>
Cc: SeongJae Park <sj@kernel.org>
Cc: Song Liu <songliubraving@fb.com>
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Zi Yan <ziy@nvidia.com>
Cc: Dan Carpenter <dan.carpenter@oracle.com>
Cc: "Souptick Joarder (HPE)" <jrdr.linux@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>1 parent 50ad2f2 commit d8ea7cc
1 file changed
+58
-25
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
| 76 | + | |
| 77 | + | |
76 | 78 | | |
77 | 79 | | |
78 | 80 | | |
| |||
86 | 88 | | |
87 | 89 | | |
88 | 90 | | |
| 91 | + | |
| 92 | + | |
89 | 93 | | |
90 | 94 | | |
91 | 95 | | |
| |||
554 | 558 | | |
555 | 559 | | |
556 | 560 | | |
| 561 | + | |
557 | 562 | | |
558 | 563 | | |
559 | 564 | | |
| |||
566 | 571 | | |
567 | 572 | | |
568 | 573 | | |
| 574 | + | |
569 | 575 | | |
570 | | - | |
| 576 | + | |
| 577 | + | |
571 | 578 | | |
572 | 579 | | |
573 | 580 | | |
| |||
587 | 594 | | |
588 | 595 | | |
589 | 596 | | |
590 | | - | |
591 | | - | |
592 | | - | |
593 | | - | |
594 | | - | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
595 | 605 | | |
596 | 606 | | |
597 | 607 | | |
| |||
654 | 664 | | |
655 | 665 | | |
656 | 666 | | |
657 | | - | |
658 | | - | |
659 | | - | |
660 | | - | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
661 | 675 | | |
662 | 676 | | |
663 | 677 | | |
| |||
666 | 680 | | |
667 | 681 | | |
668 | 682 | | |
669 | | - | |
| 683 | + | |
670 | 684 | | |
671 | 685 | | |
672 | 686 | | |
| |||
745 | 759 | | |
746 | 760 | | |
747 | 761 | | |
| 762 | + | |
748 | 763 | | |
749 | 764 | | |
750 | 765 | | |
| |||
1025 | 1040 | | |
1026 | 1041 | | |
1027 | 1042 | | |
1028 | | - | |
| 1043 | + | |
1029 | 1044 | | |
1030 | 1045 | | |
1031 | 1046 | | |
| |||
1116 | 1131 | | |
1117 | 1132 | | |
1118 | 1133 | | |
1119 | | - | |
| 1134 | + | |
| 1135 | + | |
| 1136 | + | |
1120 | 1137 | | |
1121 | 1138 | | |
1122 | 1139 | | |
| |||
1134 | 1151 | | |
1135 | 1152 | | |
1136 | 1153 | | |
| 1154 | + | |
1137 | 1155 | | |
1138 | | - | |
| 1156 | + | |
| 1157 | + | |
1139 | 1158 | | |
1140 | 1159 | | |
1141 | 1160 | | |
| |||
1165 | 1184 | | |
1166 | 1185 | | |
1167 | 1186 | | |
1168 | | - | |
1169 | | - | |
1170 | | - | |
1171 | | - | |
1172 | | - | |
| 1187 | + | |
| 1188 | + | |
| 1189 | + | |
| 1190 | + | |
| 1191 | + | |
| 1192 | + | |
| 1193 | + | |
| 1194 | + | |
1173 | 1195 | | |
1174 | 1196 | | |
1175 | 1197 | | |
| |||
1220 | 1242 | | |
1221 | 1243 | | |
1222 | 1244 | | |
1223 | | - | |
1224 | | - | |
1225 | | - | |
| 1245 | + | |
| 1246 | + | |
| 1247 | + | |
| 1248 | + | |
| 1249 | + | |
| 1250 | + | |
| 1251 | + | |
| 1252 | + | |
| 1253 | + | |
1226 | 1254 | | |
1227 | 1255 | | |
1228 | 1256 | | |
1229 | 1257 | | |
1230 | | - | |
| 1258 | + | |
| 1259 | + | |
| 1260 | + | |
1231 | 1261 | | |
1232 | 1262 | | |
1233 | 1263 | | |
| |||
1896 | 1926 | | |
1897 | 1927 | | |
1898 | 1928 | | |
1899 | | - | |
| 1929 | + | |
| 1930 | + | |
| 1931 | + | |
1900 | 1932 | | |
1901 | 1933 | | |
1902 | 1934 | | |
| |||
1947 | 1979 | | |
1948 | 1980 | | |
1949 | 1981 | | |
1950 | | - | |
| 1982 | + | |
| 1983 | + | |
1951 | 1984 | | |
1952 | 1985 | | |
1953 | 1986 | | |
| |||
0 commit comments