From: Peter Zijlstra <[email protected]>
Abstract the various page counts used to drive the scanner.
API:
give the 'active', 'inactive' and free count for the selected pgdat.
(free interpretation of '' words)
void __page_replace_counts(unsigned long *, unsigned long *,
unsigned long *, struct pglist_data *);
total number of pages in the policies care
unsigned long __page_replace_nr_pages(struct zone *);
number of pages to base the scan speed on
unsigned long __page_replace_nr_scan(struct zone *);
Signed-off-by: Peter Zijlstra <[email protected]>
Signed-off-by: Marcelo Tosatti <[email protected]>
---
include/linux/mm_page_replace.h | 3 +++
include/linux/mm_use_once_policy.h | 5 +++++
mm/page_alloc.c | 12 +-----------
mm/useonce.c | 16 ++++++++++++++++
mm/vmscan.c | 6 +++---
5 files changed, 28 insertions(+), 14 deletions(-)
Index: linux-2.6-git/include/linux/mm_page_replace.h
===================================================================
--- linux-2.6-git.orig/include/linux/mm_page_replace.h
+++ linux-2.6-git/include/linux/mm_page_replace.h
@@ -95,6 +95,9 @@ extern void page_replace_shrink(struct z
/* void __page_replace_rotate_reclaimable(struct zone *, struct page *); */
extern void page_replace_show(struct zone *);
extern void page_replace_zoneinfo(struct zone *, struct seq_file *);
+extern void __page_replace_counts(unsigned long *, unsigned long *,
+ unsigned long *, struct pglist_data *);
+/* unsigned long __page_replace_nr_pages(struct zone *); */
#ifdef CONFIG_MIGRATION
extern int page_replace_isolate(struct page *p);
Index: linux-2.6-git/mm/useonce.c
===================================================================
--- linux-2.6-git.orig/mm/useonce.c
+++ linux-2.6-git/mm/useonce.c
@@ -478,3 +478,19 @@ void page_replace_zoneinfo(struct zone *
zone->spanned_pages,
zone->present_pages);
}
+
+void __page_replace_counts(unsigned long *active, unsigned long *inactive,
+ unsigned long *free, struct pglist_data *pgdat)
+{
+ struct zone *zones = pgdat->node_zones;
+ int i;
+
+ *active = 0;
+ *inactive = 0;
+ *free = 0;
+ for (i = 0; i < MAX_NR_ZONES; i++) {
+ *active += zones[i].nr_active;
+ *inactive += zones[i].nr_inactive;
+ *free += zones[i].free_pages;
+ }
+}
Index: linux-2.6-git/mm/page_alloc.c
===================================================================
--- linux-2.6-git.orig/mm/page_alloc.c
+++ linux-2.6-git/mm/page_alloc.c
@@ -1307,17 +1307,7 @@ EXPORT_SYMBOL(mod_page_state_offset);
void __get_zone_counts(unsigned long *active, unsigned long *inactive,
unsigned long *free, struct pglist_data *pgdat)
{
- struct zone *zones = pgdat->node_zones;
- int i;
-
- *active = 0;
- *inactive = 0;
- *free = 0;
- for (i = 0; i < MAX_NR_ZONES; i++) {
- *active += zones[i].nr_active;
- *inactive += zones[i].nr_inactive;
- *free += zones[i].free_pages;
- }
+ __page_replace_counts(active, inactive, free, pgdat);
}
void get_zone_counts(unsigned long *active,
Index: linux-2.6-git/include/linux/mm_use_once_policy.h
===================================================================
--- linux-2.6-git.orig/include/linux/mm_use_once_policy.h
+++ linux-2.6-git/include/linux/mm_use_once_policy.h
@@ -135,5 +135,10 @@ static inline void __page_replace_rotate
}
}
+static inline unsigned long __page_replace_nr_pages(struct zone *zone)
+{
+ return zone->nr_active + zone->nr_inactive;
+}
+
#endif /* __KERNEL__ */
#endif /* _LINUX_MM_USEONCE_POLICY_H */
Index: linux-2.6-git/mm/vmscan.c
===================================================================
--- linux-2.6-git.orig/mm/vmscan.c
+++ linux-2.6-git/mm/vmscan.c
@@ -1033,7 +1033,7 @@ int try_to_free_pages(struct zone **zone
continue;
zone->temp_priority = DEF_PRIORITY;
- lru_pages += zone->nr_active + zone->nr_inactive;
+ lru_pages += __page_replace_nr_pages(zone);
}
for (priority = DEF_PRIORITY; priority >= 0; priority--) {
@@ -1175,7 +1175,7 @@ scan:
for (i = 0; i <= end_zone; i++) {
struct zone *zone = pgdat->node_zones + i;
- lru_pages += zone->nr_active + zone->nr_inactive;
+ lru_pages += __page_replace_nr_pages(zone);
}
/*
@@ -1219,7 +1219,7 @@ scan:
if (zone->all_unreclaimable)
continue;
if (nr_slab == 0 && zone->pages_scanned >=
- (zone->nr_active + zone->nr_inactive) * 4)
+ __page_replace_nr_pages(zone) * 4)
zone->all_unreclaimable = 1;
/*
* If we've done a decent amount of scanning and
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]