summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/linux/pagevec.h4
-rw-r--r--mm/swap.c5
2 files changed, 7 insertions, 2 deletions
diff --git a/include/linux/pagevec.h b/include/linux/pagevec.h
index 4f56e0ad9d00..95c75c858d1f 100644
--- a/include/linux/pagevec.h
+++ b/include/linux/pagevec.h
@@ -17,7 +17,8 @@ struct address_space;
struct pagevec {
unsigned long nr;
- unsigned long cold;
+ bool cold;
+ bool drained;
struct page *pages[PAGEVEC_SIZE];
};
@@ -54,6 +55,7 @@ static inline void pagevec_init(struct pagevec *pvec, int cold)
{
pvec->nr = 0;
pvec->cold = cold;
+ pvec->drained = false;
}
static inline void pagevec_reinit(struct pagevec *pvec)
diff --git a/mm/swap.c b/mm/swap.c
index 4edac536fe24..3e564a95ee73 100644
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -833,7 +833,10 @@ EXPORT_SYMBOL(release_pages);
*/
void __pagevec_release(struct pagevec *pvec)
{
- lru_add_drain();
+ if (!pvec->drained) {
+ lru_add_drain();
+ pvec->drained = true;
+ }
release_pages(pvec->pages, pagevec_count(pvec), pvec->cold);
pagevec_reinit(pvec);
}