[PATCH 39/39] mm: use-once: cleanup of the insertion logic

Peter Zijlstra
2006-07-12T14:44:38Z

Make the use-once policy use only a single PCP for insertion.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>

mm/useonce.c | 24 +-----------------------
1 file changed, 1 insertion(+), 23 deletions(-)

Index: linux-2.6/mm/useonce.c
===================================================================
--- linux-2.6.orig/mm/useonce.c 2006-07-12 16:10:56.000000000 +0200
+++ linux-2.6/mm/useonce.c 2006-07-12 16:10:56.000000000 +0200
@@ -26,9 +26,8 @@ void __init pgrep_init_zone(struct zone
* @page: the page to add
*/
static DEFINE_PER_CPU(struct pagevec, lru_add_pvecs) = { 0, };
-static DEFINE_PER_CPU(struct pagevec, lru_add_active_pvecs) = { 0, };

-static inline void lru_cache_add(struct page *page)
+void fastcall pgrep_add(struct page *page)
{
struct pagevec *pvec = &get_cpu_var(lru_add_pvecs);

@@ -38,33 +37,12 @@ static inline void lru_cache_add(struct
put_cpu_var(lru_add_pvecs);
}

-static inline void lru_cache_add_active(struct page *page)
-{
- struct pagevec *pvec = &get_cpu_var(lru_add_active_pvecs);
-
- page_cache_get(page);
- if (!pagevec_add(pvec, page))
- __pagevec_pgrep_add(pvec);
- put_cpu_var(lru_add_active_pvecs);
-}
-
-void fastcall pgrep_add(struct page *page)
-{
- if (PageActive(page))
- lru_cache_add_active(page);
- else
- lru_cache_add(page);
-}
-
void __pgrep_add_drain(unsigned int cpu)
{
struct pagevec *pvec = &per_cpu(lru_add_pvecs, cpu);

if (pagevec_count(pvec))
__pagevec_pgrep_add(pvec);
- pvec = &per_cpu(lru_add_active_pvecs, cpu);
- if (pagevec_count(pvec))
- __pagevec_pgrep_add(pvec);
}

void pgrep_reinsert(struct list_head *page_list)