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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 2 Jun 2011 15:29:54 +0200
From:	Andrea Arcangeli <aarcange@...hat.com>
To:	Mel Gorman <mgorman@...e.de>
Cc:	Minchan Kim <minchan.kim@...il.com>, akpm@...ux-foundation.org,
	Ury Stankevich <urykhy@...il.com>,
	KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>,
	linux-kernel@...r.kernel.org, linux-mm@...ck.org, stable@...nel.org
Subject: Re: [PATCH] mm: compaction: Abort compaction if too many pages are
 isolated and caller is asynchronous

On Thu, Jun 02, 2011 at 02:03:52AM +0100, Mel Gorman wrote:
> diff --git a/mm/huge_memory.c b/mm/huge_memory.c
> index 2d29c9a..65fa251 100644
> --- a/mm/huge_memory.c
> +++ b/mm/huge_memory.c
> @@ -631,12 +631,14 @@ static int __do_huge_pmd_anonymous_page(struct mm_struct *mm,
>  		entry = mk_pmd(page, vma->vm_page_prot);
>  		entry = maybe_pmd_mkwrite(pmd_mkdirty(entry), vma);
>  		entry = pmd_mkhuge(entry);
> +
>  		/*
> -		 * The spinlocking to take the lru_lock inside
> -		 * page_add_new_anon_rmap() acts as a full memory
> -		 * barrier to be sure clear_huge_page writes become
> -		 * visible after the set_pmd_at() write.
> +		 * Need a write barrier to ensure the writes from
> +		 * clear_huge_page become visible before the
> +		 * set_pmd_at
>  		 */
> +		smp_wmb();
> +

On x86 at least this is noop because of the
spin_lock(&page_table_lock) after clear_huge_page. But I'm not against
adding this in case other archs supports THP later.

But smp_wmb() is optimized away at build time by cpp so this can't
possibly help if you're reproducing !SMP.

>  		page_add_new_anon_rmap(page, vma, haddr);
>  		set_pmd_at(mm, haddr, pmd, entry);
>  		prepare_pmd_huge_pte(pgtable, mm);
> @@ -753,6 +755,13 @@ int copy_huge_pmd(struct mm_struct *dst_mm, struct mm_struct *src_mm,
>  
>  	pmdp_set_wrprotect(src_mm, addr, src_pmd);
>  	pmd = pmd_mkold(pmd_wrprotect(pmd));
> +
> +	/*
> +	 * Write barrier to make sure the setup for the PMD is fully visible
> +	 * before the set_pmd_at
> +	 */
> +	smp_wmb();
> +
>  	set_pmd_at(dst_mm, addr, dst_pmd, pmd);
>  	prepare_pmd_huge_pte(pgtable, dst_mm);

This part seems superfluous to me, it's also noop for !SMP. Only wmb()
would stay. the pmd is perfectly fine to stay in a register, not even
a compiler barrier is needed, even less a smp serialization.
--
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