lkml.org 
[lkml]   [2008]   [Sep]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[PATCH 2/12] memcg move charege() call to swapped-in page under lock_page()
    While page-cache's charge/uncharge is done under page_lock(), swap-cache
    isn't. (anonymous page is charged when it's newly allocated.)

    This patch moves do_swap_page()'s charge() call under lock. This helps
    us to avoid to charge already mapped one, unnecessary calls.

    Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>

    mm/memory.c | 7 +++----
    1 file changed, 3 insertions(+), 4 deletions(-)

    Index: mmotm-2.6.27-rc7+/mm/memory.c
    ===================================================================
    --- mmotm-2.6.27-rc7+.orig/mm/memory.c
    +++ mmotm-2.6.27-rc7+/mm/memory.c
    @@ -2320,15 +2320,14 @@ static int do_swap_page(struct mm_struct
    count_vm_event(PGMAJFAULT);
    }

    + lock_page(page);
    + delayacct_clear_flag(DELAYACCT_PF_SWAPIN);
    +
    if (mem_cgroup_charge(page, mm, GFP_KERNEL)) {
    - delayacct_clear_flag(DELAYACCT_PF_SWAPIN);
    ret = VM_FAULT_OOM;
    goto out;
    }
    -
    mark_page_accessed(page);
    - lock_page(page);
    - delayacct_clear_flag(DELAYACCT_PF_SWAPIN);

    /*
    * Back out if somebody else already faulted in this pte.


    \
     
     \ /
      Last update: 2008-09-25 08:13    [W:4.267 / U:0.028 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site