Re: [PATCH 25/33] userfaultfd: shmem: add userfaultfd hook for shared memory faults

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]