Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 284409
b: refs/heads/master
c: 2bcf887
h: refs/heads/master
i:
  284407: 2f257e4
v: v3
  • Loading branch information
Hugh Dickins authored and Linus Torvalds committed Jan 13, 2012
1 parent e471b34 commit 7c7fbbd
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 40 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: 90b3feaec8ffb167abd8903bf111605c2f035aa8
refs/heads/master: 2bcf887963812c075f80a14e1fad8ec7e1c67acf
2 changes: 0 additions & 2 deletions trunk/include/linux/pagevec.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ struct pagevec {

void __pagevec_release(struct pagevec *pvec);
void ____pagevec_lru_add(struct pagevec *pvec, enum lru_list lru);
void pagevec_strip(struct pagevec *pvec);
unsigned pagevec_lookup(struct pagevec *pvec, struct address_space *mapping,
pgoff_t start, unsigned nr_pages);
unsigned pagevec_lookup_tag(struct pagevec *pvec,
Expand Down Expand Up @@ -59,7 +58,6 @@ 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))
Expand Down
19 changes: 0 additions & 19 deletions trunk/mm/swap.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include <linux/init.h>
#include <linux/export.h>
#include <linux/mm_inline.h>
#include <linux/buffer_head.h> /* for try_to_release_page() */
#include <linux/percpu_counter.h>
#include <linux/percpu.h>
#include <linux/cpu.h>
Expand Down Expand Up @@ -730,24 +729,6 @@ void ____pagevec_lru_add(struct pagevec *pvec, enum lru_list lru)

EXPORT_SYMBOL(____pagevec_lru_add);

/*
* Try to drop buffers from the pages in a pagevec
*/
void pagevec_strip(struct pagevec *pvec)
{
int i;

for (i = 0; i < pagevec_count(pvec); i++) {
struct page *page = pvec->pages[i];

if (page_has_private(page) && trylock_page(page)) {
if (page_has_private(page))
try_to_release_page(page, 0);
unlock_page(page);
}
}
}

/**
* pagevec_lookup - gang pagecache lookup
* @pvec: Where the resulting pages are placed
Expand Down
58 changes: 40 additions & 18 deletions trunk/mm/vmscan.c
Original file line number Diff line number Diff line change
Expand Up @@ -1398,12 +1398,10 @@ putback_lru_pages(struct mem_cgroup_zone *mz, struct scan_control *sc,
struct list_head *page_list)
{
struct page *page;
struct pagevec pvec;
LIST_HEAD(pages_to_free);
struct zone *zone = mz->zone;
struct zone_reclaim_stat *reclaim_stat = get_reclaim_stat(mz);

pagevec_init(&pvec, 1);

/*
* Put back any unfreeable pages.
*/
Expand All @@ -1427,17 +1425,24 @@ putback_lru_pages(struct mem_cgroup_zone *mz, struct scan_control *sc,
int numpages = hpage_nr_pages(page);
reclaim_stat->recent_rotated[file] += numpages;
}
if (!pagevec_add(&pvec, page)) {
spin_unlock_irq(&zone->lru_lock);
__pagevec_release(&pvec);
spin_lock_irq(&zone->lru_lock);
if (put_page_testzero(page)) {
__ClearPageLRU(page);
__ClearPageActive(page);
del_page_from_lru_list(zone, page, lru);

if (unlikely(PageCompound(page))) {
spin_unlock_irq(&zone->lru_lock);
(*get_compound_page_dtor(page))(page);
spin_lock_irq(&zone->lru_lock);
} else
list_add(&page->lru, &pages_to_free);
}
}
__mod_zone_page_state(zone, NR_ISOLATED_ANON, -nr_anon);
__mod_zone_page_state(zone, NR_ISOLATED_FILE, -nr_file);

spin_unlock_irq(&zone->lru_lock);
pagevec_release(&pvec);
free_hot_cold_page_list(&pages_to_free, 1);
}

static noinline_for_stack void
Expand Down Expand Up @@ -1647,13 +1652,23 @@ shrink_inactive_list(unsigned long nr_to_scan, struct mem_cgroup_zone *mz,

static void move_active_pages_to_lru(struct zone *zone,
struct list_head *list,
struct list_head *pages_to_free,
enum lru_list lru)
{
unsigned long pgmoved = 0;
struct pagevec pvec;
struct page *page;

pagevec_init(&pvec, 1);
if (buffer_heads_over_limit) {
spin_unlock_irq(&zone->lru_lock);
list_for_each_entry(page, list, lru) {
if (page_has_private(page) && trylock_page(page)) {
if (page_has_private(page))
try_to_release_page(page, 0);
unlock_page(page);
}
}
spin_lock_irq(&zone->lru_lock);
}

while (!list_empty(list)) {
struct lruvec *lruvec;
Expand All @@ -1667,12 +1682,17 @@ static void move_active_pages_to_lru(struct zone *zone,
list_move(&page->lru, &lruvec->lists[lru]);
pgmoved += hpage_nr_pages(page);

if (!pagevec_add(&pvec, page) || list_empty(list)) {
spin_unlock_irq(&zone->lru_lock);
if (buffer_heads_over_limit)
pagevec_strip(&pvec);
__pagevec_release(&pvec);
spin_lock_irq(&zone->lru_lock);
if (put_page_testzero(page)) {
__ClearPageLRU(page);
__ClearPageActive(page);
del_page_from_lru_list(zone, page, lru);

if (unlikely(PageCompound(page))) {
spin_unlock_irq(&zone->lru_lock);
(*get_compound_page_dtor(page))(page);
spin_lock_irq(&zone->lru_lock);
} else
list_add(&page->lru, pages_to_free);
}
}
__mod_zone_page_state(zone, NR_LRU_BASE + lru, pgmoved);
Expand Down Expand Up @@ -1766,12 +1786,14 @@ static void shrink_active_list(unsigned long nr_pages,
*/
reclaim_stat->recent_rotated[file] += nr_rotated;

move_active_pages_to_lru(zone, &l_active,
move_active_pages_to_lru(zone, &l_active, &l_hold,
LRU_ACTIVE + file * LRU_FILE);
move_active_pages_to_lru(zone, &l_inactive,
move_active_pages_to_lru(zone, &l_inactive, &l_hold,
LRU_BASE + file * LRU_FILE);
__mod_zone_page_state(zone, NR_ISOLATED_ANON + file, -nr_taken);
spin_unlock_irq(&zone->lru_lock);

free_hot_cold_page_list(&l_hold, 1);
}

#ifdef CONFIG_SWAP
Expand Down

0 comments on commit 7c7fbbd

Please sign in to comment.