From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf0-f199.google.com (mail-pf0-f199.google.com [209.85.192.199]) by kanga.kvack.org (Postfix) with ESMTP id 76E116B0321 for ; Fri, 4 Nov 2016 10:53:33 -0400 (EDT) Received: by mail-pf0-f199.google.com with SMTP id 17so21039608pfy.2 for ; Fri, 04 Nov 2016 07:53:33 -0700 (PDT) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com. [148.163.156.1]) by mx.google.com with ESMTPS id q7si13238641pax.216.2016.11.04.07.53.32 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 04 Nov 2016 07:53:32 -0700 (PDT) Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id uA4EmRVL121724 for ; Fri, 4 Nov 2016 10:53:32 -0400 Received: from e06smtp15.uk.ibm.com (e06smtp15.uk.ibm.com [195.75.94.111]) by mx0a-001b2d01.pphosted.com with ESMTP id 26gsev61fk-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Fri, 04 Nov 2016 10:53:31 -0400 Received: from localhost by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 4 Nov 2016 14:53:29 -0000 Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id 50CF01B08023 for ; Fri, 4 Nov 2016 14:55:37 +0000 (GMT) Received: from d06av04.portsmouth.uk.ibm.com (d06av04.portsmouth.uk.ibm.com [9.149.37.216]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id uA4ErQX916253438 for ; Fri, 4 Nov 2016 14:53:26 GMT Received: from d06av04.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av04.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id uA4ErPrZ005190 for ; Fri, 4 Nov 2016 08:53:26 -0600 Date: Fri, 4 Nov 2016 08:53:17 -0600 From: Mike Rapoport Subject: Re: [PATCH 25/33] userfaultfd: shmem: add userfaultfd hook for shared memory faults References: <1478115245-32090-1-git-send-email-aarcange@redhat.com> <1478115245-32090-26-git-send-email-aarcange@redhat.com> <07ce01d23679$c2be2670$483a7350$@alibaba-inc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <07ce01d23679$c2be2670$483a7350$@alibaba-inc.com> Message-Id: <20161104145316.GA5605@rapoport-lnx> Sender: owner-linux-mm@kvack.org List-ID: To: Hillf Danton Cc: 'Andrea Arcangeli' , 'Andrew Morton' , linux-mm@kvack.org, 'Mike Kravetz' , "'Dr. David Alan Gilbert'" , 'Shaohua Li' , 'Pavel Emelyanov' On Fri, Nov 04, 2016 at 04:59:32PM +0800, Hillf Danton wrote: > > @@ -1542,7 +1544,7 @@ static int shmem_replace_page(struct page **pagep, gfp_t gfp, > > */ > > static int shmem_getpage_gfp(struct inode *inode, pgoff_t index, > > struct page **pagep, enum sgp_type sgp, gfp_t gfp, > > - struct mm_struct *fault_mm, int *fault_type) > > + struct vm_area_struct *vma, struct vm_fault *vmf, int *fault_type) > > { > > struct address_space *mapping = inode->i_mapping; > > struct shmem_inode_info *info; > > @@ -1597,7 +1599,7 @@ static int shmem_getpage_gfp(struct inode *inode, pgoff_t index, > > */ > > info = SHMEM_I(inode); > > sbinfo = SHMEM_SB(inode->i_sb); > > - charge_mm = fault_mm ? : current->mm; > > + charge_mm = vma ? vma->vm_mm : current->mm; > > > > if (swap.val) { > > /* Look it up and read it in.. */ > > @@ -1607,7 +1609,8 @@ static int shmem_getpage_gfp(struct inode *inode, pgoff_t index, > > if (fault_type) { > > *fault_type |= VM_FAULT_MAJOR; > > count_vm_event(PGMAJFAULT); > > - mem_cgroup_count_vm_event(fault_mm, PGMAJFAULT); > > + mem_cgroup_count_vm_event(vma->vm_mm, > > + PGMAJFAULT); > Seems vma is not valid in some cases. Well, currently, when fault_type != NULL, the vma is valid. Still it would be better to use charge_mm here. Will repost soon. > > } > > /* Here we actually start the io */ > > page = shmem_swapin(swap, gfp, info, index); -- Sincerely yours, Mike. -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org