lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <50184CF3.8040505@redhat.com>
Date:	Tue, 31 Jul 2012 17:24:03 -0400
From:	Rik van Riel <riel@...hat.com>
To:	Peter Zijlstra <a.p.zijlstra@...llo.nl>
CC:	mingo@...nel.org, oleg@...hat.com, pjt@...gle.com,
	akpm@...ux-foundation.org, torvalds@...ux-foundation.org,
	tglx@...utronix.de, Lee.Schermerhorn@...com,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 10/19] mm, mpol: Use special PROT_NONE to migrate pages

On 07/31/2012 03:12 PM, Peter Zijlstra wrote:

> +	if (unlikely(pmd_trans_splitting(entry))) {
> +		spin_unlock(&mm->page_table_lock);
> +		wait_split_huge_page(vma->anon_vma, pmd);
> +		return;
> +	}
> +
> +#ifdef CONFIG_NUMA
> +	page = pmd_page(entry);
> +	VM_BUG_ON(!PageCompound(page) || !PageHead(page));
> +
> +	get_page(page);
> +	spin_unlock(&mm->page_table_lock);
> +
> +	/*
> +	 * XXX should we serialize against split_huge_page ?
> +	 */

I believe we are already serialized here, because we check
for pmd_trans_splitting while holding the page table lock.

The THP code grabs the page table lock when modifying this
status, so we should be good.

> +	/*
> +	 * Due to lacking code to migrate thp pages, we'll split
> +	 * (which preserves the special PROT_NONE) and re-take the
> +	 * fault on the normal pages.
> +	 */
> +	split_huge_page(page);
> +	put_page(page);
> +	return;

Likewise, the THP code serializes split_huge_page, and has
protection against multiple simultaneous invocations of
split_huge_page.

A second invocation of split_huge_page will see that the
page was already split, and it will bail out.

> +do_fixup:
> +	spin_lock(&mm->page_table_lock);
> +	if (unlikely(!pmd_same(*pmd, entry)))
> +		goto out_unlock;

If the THP was split for another reason than a NUMA
fault, the !pmd_same check here should result in us
doing the right thing automatically.

I believe this code is correct.

Acked-by: Rik van Riel <riel@...hat.com>

-- 
All rights reversed
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ