lkml.org 
[lkml]   [2013]   [Jun]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    SubjectRe: [v5][PATCH 5/6] mm: vmscan: batch shrink_page_list() locking operations
    From
    On Tue, Jun 4, 2013 at 4:02 AM, Dave Hansen <dave@sr71.net> wrote:
    > +/*
    > + * pages come in here (via remove_list) locked and leave unlocked
    > + * (on either ret_pages or free_pages)
    > + *
    > + * We do this batching so that we free batches of pages with a
    > + * single mapping->tree_lock acquisition/release. This optimization
    > + * only makes sense when the pages on remove_list all share a
    > + * page_mapping(). If this is violated you will BUG_ON().
    > + */
    > +static int __remove_mapping_batch(struct list_head *remove_list,
    > + struct list_head *ret_pages,
    > + struct list_head *free_pages)
    > +{
    > + int nr_reclaimed = 0;
    > + struct address_space *mapping;
    > + struct page *page;
    > + LIST_HEAD(need_free_mapping);
    > +
    > + if (list_empty(remove_list))
    > + return 0;
    > +
    > + mapping = page_mapping(lru_to_page(remove_list));
    > + spin_lock_irq(&mapping->tree_lock);
    > + while (!list_empty(remove_list)) {
    > + page = lru_to_page(remove_list);
    > + BUG_ON(!PageLocked(page));
    > + BUG_ON(page_mapping(page) != mapping);
    > + list_del(&page->lru);
    > +
    > + if (!__remove_mapping(mapping, page)) {
    > + unlock_page(page);
    > + list_add(&page->lru, ret_pages);
    > + continue;
    > + }
    > + list_add(&page->lru, &need_free_mapping);
    > + }
    > + spin_unlock_irq(&mapping->tree_lock);
    > +
    While reclaiming pages, can we open ears upon IRQ controller,
    if the page list length is over 10, or even 20?


    \
     
     \ /
      Last update: 2013-06-04 04:01    [W:5.983 / U:0.492 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site