Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Vlastimil Babka <vbabka@suse.cz>
To: David Rientjes <rientjes@google.com>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Mel Gorman <mgorman@techsingularity.net>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [patch] mm, thp: copying user pages must schedule on collapse
Date: Thu, 11 May 2017 11:51:37 +0200	[thread overview]
Message-ID: <b139f4cc-50b5-dc5d-76c5-1dffe658cd16@suse.cz> (raw)
In-Reply-To: <alpine.DEB.2.10.1705101426380.109808@chino.kir.corp.google.com>

On 05/10/2017 11:27 PM, David Rientjes wrote:
> We have encountered need_resched warnings in __collapse_huge_page_copy()
> while doing {clear,copy}_user_highpage() over HPAGE_PMD_NR source pages.
> 
> mm->mmap_sem is held for write, but the iteration is well bounded.
> 
> Reschedule as needed.
> 
> Signed-off-by: David Rientjes <rientjes@google.com>

Acked-by: Vlastimil Babka <vbabka@suse.cz>

> ---
>  mm/khugepaged.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/mm/khugepaged.c b/mm/khugepaged.c
> --- a/mm/khugepaged.c
> +++ b/mm/khugepaged.c
> @@ -612,7 +612,8 @@ static void __collapse_huge_page_copy(pte_t *pte, struct page *page,
>  				      spinlock_t *ptl)
>  {
>  	pte_t *_pte;
> -	for (_pte = pte; _pte < pte+HPAGE_PMD_NR; _pte++) {
> +	for (_pte = pte; _pte < pte + HPAGE_PMD_NR;
> +				_pte++, page++, address += PAGE_SIZE) {
>  		pte_t pteval = *_pte;
>  		struct page *src_page;
>  
> @@ -651,9 +652,7 @@ static void __collapse_huge_page_copy(pte_t *pte, struct page *page,
>  			spin_unlock(ptl);
>  			free_page_and_swap_cache(src_page);
>  		}
> -
> -		address += PAGE_SIZE;
> -		page++;
> +		cond_resched();
>  	}
>  }
>  
> 

--
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: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

      reply	other threads:[~2017-05-11  9:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-10 21:27 [patch] mm, thp: copying user pages must schedule on collapse David Rientjes
2017-05-11  9:51 ` Vlastimil Babka [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b139f4cc-50b5-dc5d-76c5-1dffe658cd16@suse.cz \
    --to=vbabka@suse.cz \
    --cc=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@techsingularity.net \
    --cc=rientjes@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox