Hi Hugh, On Wed, May 18, 2011 at 3:24 AM, Hugh Dickins <hughd@xxxxxxxxxx> wrote: > mem_cgroup_count_vm_event() should update the PGMAJFAULT count for the > target mm, not for current mm (but of course they're usually the same). > > We don't know the target mm in shmem_getpage(), so do it at the outer > level in shmem_fault(); and it's easier to follow if we move the > count_vm_event(PGMAJFAULT) there too. > > Hah, it was using __count_vm_event() before, sneaking that update into > the unpreemptible section under info->lock: well, it comes to the same > on x86 at least, and I still think it's best to keep these together. > > Signed-off-by: Hugh Dickins <hughd@xxxxxxxxxx> It's good to me but I have a nitpick. You are changing behavior a bit. Old behavior is to account FAULT although the operation got failed. But new one is to not account it. I think we have to account it regardless of whether it is successful or not. That's because it is fact fault happens. > --- > > Âmm/shmem.c |  13 ++++++------- > Â1 file changed, 6 insertions(+), 7 deletions(-) > > --- mmotm/mm/shmem.c  Â2011-05-13 14:57:45.367884578 -0700 > +++ linux/mm/shmem.c  Â2011-05-17 10:27:19.901934756 -0700 > @@ -1293,14 +1293,10 @@ repeat: >        Âswappage = lookup_swap_cache(swap); >        Âif (!swappage) { >            Âshmem_swp_unmap(entry); > +            spin_unlock(&info->lock); >            Â/* here we actually do the io */ > -            if (type && !(*type & VM_FAULT_MAJOR)) { > -                __count_vm_event(PGMAJFAULT); > -                mem_cgroup_count_vm_event(current->mm, > -                             PGMAJFAULT); > +            if (type) >                Â*type |= VM_FAULT_MAJOR; > -            } > -            spin_unlock(&info->lock); >            Âswappage = shmem_swapin(swap, gfp, info, idx); >            Âif (!swappage) { >                Âspin_lock(&info->lock); > @@ -1539,7 +1535,10 @@ static int shmem_fault(struct vm_area_st >    Âerror = shmem_getpage(inode, vmf->pgoff, &vmf->page, SGP_CACHE, &ret); >    Âif (error) >        Âreturn ((error == -ENOMEM) ? VM_FAULT_OOM : VM_FAULT_SIGBUS); > - > +    if (ret & VM_FAULT_MAJOR) { > +        count_vm_event(PGMAJFAULT); > +        mem_cgroup_count_vm_event(vma->vm_mm, PGMAJFAULT); > +    } >    Âreturn ret | VM_FAULT_LOCKED; > Â} > > -- Kind regards, Minchan Kim -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxxx For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/ Don't email: <a href