Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 250942
b: refs/heads/master
c: eb709b0
h: refs/heads/master
v: v3
  • Loading branch information
Shaohua Li authored and Linus Torvalds committed May 25, 2011
1 parent e1d3e58 commit 4ebc2ad
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f68aa5b445fd00b67588ade611a4efb1a34dadb4
refs/heads/master: eb709b0d062efd653a61183af8e27b2711c3cf5c
45 changes: 40 additions & 5 deletions trunk/mm/swap.c
Original file line number Diff line number Diff line change
Expand Up @@ -272,14 +272,10 @@ static void update_page_reclaim_stat(struct zone *zone, struct page *page,
memcg_reclaim_stat->recent_rotated[file]++;
}

/*
* FIXME: speed this up?
*/
void activate_page(struct page *page)
static void __activate_page(struct page *page, void *arg)
{
struct zone *zone = page_zone(page);

spin_lock_irq(&zone->lru_lock);
if (PageLRU(page) && !PageActive(page) && !PageUnevictable(page)) {
int file = page_is_file_cache(page);
int lru = page_lru_base_type(page);
Expand All @@ -292,8 +288,45 @@ void activate_page(struct page *page)

update_page_reclaim_stat(zone, page, file, 1);
}
}

#ifdef CONFIG_SMP
static DEFINE_PER_CPU(struct pagevec, activate_page_pvecs);

static void activate_page_drain(int cpu)
{
struct pagevec *pvec = &per_cpu(activate_page_pvecs, cpu);

if (pagevec_count(pvec))
pagevec_lru_move_fn(pvec, __activate_page, NULL);
}

void activate_page(struct page *page)
{
if (PageLRU(page) && !PageActive(page) && !PageUnevictable(page)) {
struct pagevec *pvec = &get_cpu_var(activate_page_pvecs);

page_cache_get(page);
if (!pagevec_add(pvec, page))
pagevec_lru_move_fn(pvec, __activate_page, NULL);
put_cpu_var(activate_page_pvecs);
}
}

#else
static inline void activate_page_drain(int cpu)
{
}

void activate_page(struct page *page)
{
struct zone *zone = page_zone(page);

spin_lock_irq(&zone->lru_lock);
__activate_page(page, NULL);
spin_unlock_irq(&zone->lru_lock);
}
#endif

/*
* Mark a page as having seen activity.
Expand Down Expand Up @@ -464,6 +497,8 @@ static void drain_cpu_pagevecs(int cpu)
pvec = &per_cpu(lru_deactivate_pvecs, cpu);
if (pagevec_count(pvec))
pagevec_lru_move_fn(pvec, lru_deactivate_fn, NULL);

activate_page_drain(cpu);
}

/**
Expand Down

0 comments on commit 4ebc2ad

Please sign in to comment.