hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/mm/page_idle.c
....@@ -1,9 +1,10 @@
11 // SPDX-License-Identifier: GPL-2.0
22 #include <linux/init.h>
3
-#include <linux/bootmem.h>
3
+#include <linux/memblock.h>
44 #include <linux/fs.h>
55 #include <linux/sysfs.h>
66 #include <linux/kobject.h>
7
+#include <linux/memory_hotplug.h>
78 #include <linux/mm.h>
89 #include <linux/mmzone.h>
910 #include <linux/pagemap.h>
....@@ -30,24 +31,20 @@
3031 */
3132 static struct page *page_idle_get_page(unsigned long pfn)
3233 {
33
- struct page *page;
34
- struct zone *zone;
34
+ struct page *page = pfn_to_online_page(pfn);
35
+ pg_data_t *pgdat;
3536
36
- if (!pfn_valid(pfn))
37
- return NULL;
38
-
39
- page = pfn_to_page(pfn);
4037 if (!page || !PageLRU(page) ||
4138 !get_page_unless_zero(page))
4239 return NULL;
4340
44
- zone = page_zone(page);
45
- spin_lock_irq(zone_lru_lock(zone));
41
+ pgdat = page_pgdat(page);
42
+ spin_lock_irq(&pgdat->lru_lock);
4643 if (unlikely(!PageLRU(page))) {
4744 put_page(page);
4845 page = NULL;
4946 }
50
- spin_unlock_irq(zone_lru_lock(zone));
47
+ spin_unlock_irq(&pgdat->lru_lock);
5148 return page;
5249 }
5350
....@@ -95,10 +92,10 @@
9592 static void page_idle_clear_pte_refs(struct page *page)
9693 {
9794 /*
98
- * Since rwc.arg is unused, rwc is effectively immutable, so we
99
- * can make it static const to save some cycles and stack.
95
+ * Since rwc.try_lock is unused, rwc is effectively immutable, so we
96
+ * can make it static to save some cycles and stack.
10097 */
101
- static const struct rmap_walk_control rwc = {
98
+ static struct rmap_walk_control rwc = {
10299 .rmap_one = page_idle_clear_pte_refs_one,
103100 .anon_lock = page_lock_anon_vma_read,
104101 };
....@@ -213,16 +210,6 @@
213210 .bin_attrs = page_idle_bin_attrs,
214211 .name = "page_idle",
215212 };
216
-
217
-#ifndef CONFIG_64BIT
218
-static bool need_page_idle(void)
219
-{
220
- return true;
221
-}
222
-struct page_ext_operations page_idle_ops = {
223
- .need = need_page_idle,
224
-};
225
-#endif
226213
227214 static int __init page_idle_init(void)
228215 {