lkml.org 
[lkml]   [2012]   [Feb]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Subject[PATCH v2 14/22] mm: push lruvec into update_page_reclaim_stat()
    From
    Date
    Push lruvec pointer into update_page_reclaim_stat()
    * drop page argument
    * drop active and file arguments, use lru instead

    Signed-off-by: Konstantin Khlebnikov <khlebnikov@openvz.org>
    ---
    mm/swap.c | 30 +++++++++---------------------
    1 files changed, 9 insertions(+), 21 deletions(-)

    diff --git a/mm/swap.c b/mm/swap.c
    index 0167d6f..a549f11 100644
    --- a/mm/swap.c
    +++ b/mm/swap.c
    @@ -281,24 +281,19 @@ void rotate_reclaimable_page(struct page *page)
    }
    }

    -static void update_page_reclaim_stat(struct zone *zone, struct page *page,
    - int file, int rotated)
    +static void update_page_reclaim_stat(struct lruvec *lruvec, enum lru_list lru)
    {
    - struct zone_reclaim_stat *reclaim_stat;
    -
    - reclaim_stat = &page_lruvec(page)->reclaim_stat;
    + struct zone_reclaim_stat *reclaim_stat = &lruvec->reclaim_stat;
    + int file = is_file_lru(lru);

    reclaim_stat->recent_scanned[file]++;
    - if (rotated)
    + if (is_active_lru(lru))
    reclaim_stat->recent_rotated[file]++;
    }

    static void __activate_page(struct page *page, void *arg)
    {
    - struct zone *zone = page_zone(page);
    -
    if (PageLRU(page) && !PageActive(page) && !PageUnevictable(page)) {
    - int file = page_is_file_cache(page);
    int lru = page_lru_base_type(page);
    struct lruvec *lruvec = page_lruvec(page);

    @@ -309,7 +304,7 @@ static void __activate_page(struct page *page, void *arg)
    add_page_to_lru_list(lruvec, page, lru);
    __count_vm_event(PGACTIVATE);

    - update_page_reclaim_stat(zone, page, file, 1);
    + update_page_reclaim_stat(lruvec, lru);
    }
    }

    @@ -372,8 +367,6 @@ EXPORT_SYMBOL(mark_page_accessed);

    static void __lru_cache_add_list(struct list_head *pages, enum lru_list lru)
    {
    - int file = is_file_lru(lru);
    - int active = is_active_lru(lru);
    struct page *page, *next;
    struct lruvec *lruvec;
    struct zone *pagezone, *zone = NULL;
    @@ -392,10 +385,10 @@ static void __lru_cache_add_list(struct list_head *pages, enum lru_list lru)
    VM_BUG_ON(PageUnevictable(page));
    VM_BUG_ON(PageLRU(page));
    SetPageLRU(page);
    - if (active)
    + if (is_active_lru(lru))
    SetPageActive(page);
    - update_page_reclaim_stat(zone, page, file, active);
    lruvec = page_lruvec(page);
    + update_page_reclaim_stat(lruvec, lru);
    add_page_to_lru_list(lruvec, page, lru);
    if (unlikely(put_page_testzero(page))) {
    __ClearPageLRU(page);
    @@ -519,7 +512,6 @@ static void lru_deactivate_fn(struct page *page, void *arg)
    {
    int lru, file;
    bool active;
    - struct zone *zone = page_zone(page);
    struct lruvec *lruvec;

    if (!PageLRU(page))
    @@ -560,7 +552,7 @@ static void lru_deactivate_fn(struct page *page, void *arg)

    if (active)
    __count_vm_event(PGDEACTIVATE);
    - update_page_reclaim_stat(zone, page, file, 0);
    + update_page_reclaim_stat(lruvec, lru);
    }

    /*
    @@ -727,9 +719,7 @@ EXPORT_SYMBOL(__pagevec_release);
    void lru_add_page_tail(struct zone* zone,
    struct page *page, struct page *page_tail)
    {
    - int active;
    enum lru_list lru;
    - const int file = 0;
    struct lruvec *lruvec = page_lruvec(page);

    VM_BUG_ON(!PageHead(page));
    @@ -742,13 +732,11 @@ void lru_add_page_tail(struct zone* zone,
    if (page_evictable(page_tail, NULL)) {
    if (PageActive(page)) {
    SetPageActive(page_tail);
    - active = 1;
    lru = LRU_ACTIVE_ANON;
    } else {
    - active = 0;
    lru = LRU_INACTIVE_ANON;
    }
    - update_page_reclaim_stat(zone, page_tail, file, active);
    + update_page_reclaim_stat(lruvec, lru);
    } else {
    SetPageUnevictable(page_tail);
    lru = LRU_UNEVICTABLE;


    \
     
     \ /
      Last update: 2012-02-20 18:37    [W:0.026 / U:30.360 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site