From 8d6282a1cf812279f490875cd55cb7a85623ac89 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Tue, 29 Oct 2002 23:36:13 -0800 Subject: [PATCH] hot-n-cold pages: free and allocate hints Add a `cold' hint to struct pagevec, and teach truncate and page reclaim to use it. Empirical testing showed that truncate's pages tend to be hot. And page reclaim's are certainly cold. --- include/linux/pagevec.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'include/linux/pagevec.h') diff --git a/include/linux/pagevec.h b/include/linux/pagevec.h index 0207270b0fe7..d149e0688b1e 100644 --- a/include/linux/pagevec.h +++ b/include/linux/pagevec.h @@ -12,6 +12,7 @@ struct address_space; struct pagevec { unsigned nr; + int cold; struct page *pages[PAGEVEC_SIZE]; }; @@ -25,7 +26,13 @@ void pagevec_strip(struct pagevec *pvec); unsigned int pagevec_lookup(struct pagevec *pvec, struct address_space *mapping, pgoff_t start, unsigned int nr_pages); -static inline void pagevec_init(struct pagevec *pvec) +static inline void pagevec_init(struct pagevec *pvec, int cold) +{ + pvec->nr = 0; + pvec->cold = cold; +} + +static inline void pagevec_reinit(struct pagevec *pvec) { pvec->nr = 0; } @@ -49,6 +56,7 @@ static inline unsigned pagevec_add(struct pagevec *pvec, struct page *page) return pagevec_space(pvec); } + static inline void pagevec_release(struct pagevec *pvec) { if (pagevec_count(pvec)) -- cgit v1.2.3