Re: [PATCH v2 4/4] hugetlb: Do early cow when page pinned on src mm

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

 



On Thu, Feb 04, 2021 at 09:11:24PM -0800, Mike Kravetz wrote:

[...]

> >>> @@ -3787,7 +3803,7 @@ int copy_hugetlb_page_range(struct mm_struct *dst, struct mm_struct *src,
> >>>  		dst_entry = huge_ptep_get(dst_pte);
> >>>  		if ((dst_pte == src_pte) || !huge_pte_none(dst_entry))
> >>>  			continue;
> >>> -
> >>> +again:
> >>>  		dst_ptl = huge_pte_lock(h, dst, dst_pte);
> >>>  		src_ptl = huge_pte_lockptr(h, src, src_pte);
> >>>  		spin_lock_nested(src_ptl, SINGLE_DEPTH_NESTING);
> > 
> > Side question: Mike, do you know why we need this lock_nested()?  Could the src
> > lock be taken due to any reason already?  It confused me when I read the chunk.
> 
> I see that it was added with commit 4647875819aa.  That was when huge pages
> used the single per-mm ptl.  Lockdep seemed to complain about taking
> &mm->page_table_lock twice.   Certainly, source and destination mm can not
> be the same.  Right?

Right, at least that's my understanding..

> I do not have the full history, but it 'looks' like
> lockdep might have been confused and this was added to keep it quiet.
> 
> BTW - Copy page range for 'normal' pages has the same spin_lock_nested().

Yes.  I'll need to take the same lock in v3, so I think I'll just follow.

Thanks,

-- 
Peter Xu





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

  Powered by Linux