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: <55BB906F.5090802@redhat.com>
Date:	Fri, 31 Jul 2015 17:12:47 +0200
From:	Jerome Marchand <jmarchan@...hat.com>
To:	"Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Andrea Arcangeli <aarcange@...hat.com>,
	Hugh Dickins <hughd@...gle.com>
CC:	Dave Hansen <dave.hansen@...el.com>, Mel Gorman <mgorman@...e.de>,
	Rik van Riel <riel@...hat.com>,
	Vlastimil Babka <vbabka@...e.cz>,
	Christoph Lameter <cl@...two.org>,
	Naoya Horiguchi <n-horiguchi@...jp.nec.com>,
	Steve Capper <steve.capper@...aro.org>,
	"Aneesh Kumar K.V" <aneesh.kumar@...ux.vnet.ibm.com>,
	Johannes Weiner <hannes@...xchg.org>,
	Michal Hocko <mhocko@...e.cz>,
	Sasha Levin <sasha.levin@...cle.com>,
	linux-kernel@...r.kernel.org, linux-mm@...ck.org
Subject: Re: [PATCHv9 31/36] thp, mm: split_huge_page(): caller need to lock
 page

On 07/20/2015 04:21 PM, Kirill A. Shutemov wrote:
> We're going to use migration entries instead of compound_lock() to
> stabilize page refcounts. Setup and remove migration entries require
> page to be locked.
> 
> Some of split_huge_page() callers already have the page locked. Let's
> require everybody to lock the page before calling split_huge_page().
> 
> Signed-off-by: Kirill A. Shutemov <kirill.shutemov@...ux.intel.com>
> Tested-by: Sasha Levin <sasha.levin@...cle.com>
> Tested-by: Aneesh Kumar K.V <aneesh.kumar@...ux.vnet.ibm.com>
> Acked-by: Vlastimil Babka <vbabka@...e.cz>

Acked-by: Jerome Marchand <jmarchan@...hat.com>

> ---
>  mm/memory-failure.c | 10 ++++++++--
>  mm/migrate.c        |  8 ++++++--
>  2 files changed, 14 insertions(+), 4 deletions(-)
> 
> diff --git a/mm/memory-failure.c b/mm/memory-failure.c
> index ef33ccf37224..f32a607d1aa3 100644
> --- a/mm/memory-failure.c
> +++ b/mm/memory-failure.c
> @@ -1143,15 +1143,18 @@ int memory_failure(unsigned long pfn, int trapno, int flags)
>  				put_page(hpage);
>  			return -EBUSY;
>  		}
> +		lock_page(hpage);
>  		if (unlikely(split_huge_page(hpage))) {
>  			pr_err("MCE: %#lx: thp split failed\n", pfn);
>  			if (TestClearPageHWPoison(p))
>  				atomic_long_sub(nr_pages, &num_poisoned_pages);
> +			unlock_page(hpage);
>  			put_page(p);
>  			if (p != hpage)
>  				put_page(hpage);
>  			return -EBUSY;
>  		}
> +		unlock_page(hpage);
>  		VM_BUG_ON_PAGE(!page_count(p), p);
>  		hpage = compound_head(p);
>  	}
> @@ -1714,10 +1717,13 @@ int soft_offline_page(struct page *page, int flags)
>  		return -EBUSY;
>  	}
>  	if (!PageHuge(page) && PageTransHuge(hpage)) {
> -		if (PageAnon(hpage) && unlikely(split_huge_page(hpage))) {
> +		lock_page(page);
> +		ret = split_huge_page(hpage);
> +		unlock_page(page);
> +		if (unlikely(ret)) {
>  			pr_info("soft offline: %#lx: failed to split THP\n",
>  				pfn);
> -			return -EBUSY;
> +			return ret;
>  		}
>  	}
>  
> diff --git a/mm/migrate.c b/mm/migrate.c
> index 67970faf544d..a9dbfd356e9d 100644
> --- a/mm/migrate.c
> +++ b/mm/migrate.c
> @@ -933,9 +933,13 @@ static ICE_noinline int unmap_and_move(new_page_t get_new_page,
>  		goto out;
>  	}
>  
> -	if (unlikely(PageTransHuge(page)))
> -		if (unlikely(split_huge_page(page)))
> +	if (unlikely(PageTransHuge(page))) {
> +		lock_page(page);
> +		rc = split_huge_page(page);
> +		unlock_page(page);
> +		if (rc)
>  			goto out;
> +	}
>  
>  	rc = __unmap_and_move(page, newpage, force, mode);
>  
> 



Download attachment "signature.asc" of type "application/pgp-signature" (474 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ