linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Weiner <jweiner@redhat.com>
To: Andrea Arcangeli <aarcange@redhat.com>
Cc: linux-mm@kvack.org, Mel Gorman <mel@csn.ul.ie>,
	Rik van Riel <riel@redhat.com>
Subject: Re: [PATCH] thp: mremap support and TLB optimization
Date: Tue, 15 Mar 2011 10:27:50 +0100	[thread overview]
Message-ID: <20110315092750.GD2140@redhat.com> (raw)
In-Reply-To: <20110311020410.GH5641@random.random>

On Fri, Mar 11, 2011 at 03:04:10AM +0100, Andrea Arcangeli wrote:
> @@ -42,7 +42,7 @@ static pmd_t *get_old_pmd(struct mm_stru
>  
>  	pmd = pmd_offset(pud, addr);
>  	split_huge_page_pmd(mm, pmd);

Wasn't getting rid of this line the sole purpose of the patch? :)

> -	if (pmd_none_or_clear_bad(pmd))
> +	if (pmd_none(*pmd))
>  		return NULL;
>  
>  	return pmd;

[...]

> @@ -151,6 +148,23 @@ unsigned long move_page_tables(struct vm
>  		new_pmd = alloc_new_pmd(vma->vm_mm, vma, new_addr);
>  		if (!new_pmd)
>  			break;
> +		if (pmd_trans_huge(*old_pmd)) {
> +			int err = move_huge_pmd(vma, old_addr, new_addr,
> +						old_end, old_pmd, new_pmd);
> +			if (err > 0) {
> +				old_addr += HPAGE_PMD_SIZE;
> +				new_addr += HPAGE_PMD_SIZE;
> +				continue;
> +			}
> +		}
> +		/*
> +		 * split_huge_page_pmd() must run outside the
> +		 * pmd_trans_huge() block above because that check
> +		 * racy. split_huge_page_pmd() will recheck
> +		 * pmd_trans_huge() but in a not racy way under the
> +		 * page_table_lock.
> +		 */
> +		split_huge_page_pmd(vma->vm_mm, old_pmd);

I don't understand what we are racing here against.  If we see a huge
pmd, it may split.  But we hold mmap_sem in write-mode, I don't see
how a regular pmd could become huge all of a sudden at this point.

	Hannes

--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  parent reply	other threads:[~2011-03-15  9:28 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-11  2:04 [PATCH] thp: mremap support and TLB optimization Andrea Arcangeli
2011-03-11 15:16 ` Rik van Riel
2011-03-11 19:44 ` Hugh Dickins
2011-03-11 20:25   ` Hugh Dickins
2011-03-12  4:28     ` Andrea Arcangeli
2011-03-12  4:02   ` Andrea Arcangeli
2011-03-15  9:27 ` Johannes Weiner [this message]
2011-03-15 10:01   ` Andrea Arcangeli
2011-03-15 12:07     ` Johannes Weiner

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=20110315092750.GD2140@redhat.com \
    --to=jweiner@redhat.com \
    --cc=aarcange@redhat.com \
    --cc=linux-mm@kvack.org \
    --cc=mel@csn.ul.ie \
    --cc=riel@redhat.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;
as well as URLs for NNTP newsgroup(s).