mm/lru: move lock into lru_note_cost
[sfrench/cifs-2.6.git] / mm / swap.c
index b4ca5b96583871ab969cf20e0d5c27a62fa684ae..c3187d04f9b2ba12a5eaee95b30d6b19881a6fd8 100644 (file)
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -268,7 +268,9 @@ void lru_note_cost(struct lruvec *lruvec, bool file, unsigned int nr_pages)
 {
        do {
                unsigned long lrusize;
+               struct pglist_data *pgdat = lruvec_pgdat(lruvec);
 
+               spin_lock_irq(&pgdat->lru_lock);
                /* Record cost event */
                if (file)
                        lruvec->file_cost += nr_pages;
@@ -292,6 +294,7 @@ void lru_note_cost(struct lruvec *lruvec, bool file, unsigned int nr_pages)
                        lruvec->file_cost /= 2;
                        lruvec->anon_cost /= 2;
                }
+               spin_unlock_irq(&pgdat->lru_lock);
        } while ((lruvec = parent_lruvec(lruvec)));
 }