Re: [PATCH] mm: incorporate read-only pages into transparent huge pages

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

 



On Fri, Jan 23, 2015 at 09:57:03AM -0500, Rik van Riel wrote:
> On 01/23/2015 06:37 AM, Kirill A. Shutemov wrote:
> > On Fri, Jan 23, 2015 at 09:47:36AM +0200, Ebru Akagunduz wrote:
> >> This patch aims to improve THP collapse rates, by allowing
> >> THP collapse in the presence of read-only ptes, like those
> >> left in place by do_swap_page after a read fault.
> >>
> >> Currently THP can collapse 4kB pages into a THP when
> >> there are up to khugepaged_max_ptes_none pte_none ptes
> >> in a 2MB range. This patch applies the same limit for
> >> read-only ptes.
> 
> >> @@ -2179,6 +2179,17 @@ static int __collapse_huge_page_isolate(struct vm_area_struct *vma,
> >>  		 */
> >>  		if (!trylock_page(page))
> >>  			goto out;
> >> +		if (!pte_write(pteval)) {
> >> +			if (PageSwapCache(page) && !reuse_swap_page(page)) {
> >> +					unlock_page(page);
> >> +					goto out;
> >> +			}
> >> +			/*
> >> +			 * Page is not in the swap cache, and page count is
> >> +			 * one (see above). It can be collapsed into a THP.
> >> +			 */
> >> +		}
> > 
> > Hm. As a side effect it will effectevely allow collapse in PROT_READ vmas,
> > right? I'm not convinced it's a good idea.
> 
> It will only allow a THP collapse if there is at least one
> read-write pte.
> 
> I suspect that excludes read-only VMAs automatically.

Ah. Okay. I missed that condition.

Looks good to me.

-- 
 Kirill A. Shutemov

--
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]