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]
Date:	Mon, 27 Apr 2015 13:50:25 +0200
From:	Vlastimil Babka <vbabka@...e.cz>
To:	"Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
	Andrew Morton <akpm@...ux-foundation.org>
CC:	linux-mm@...ck.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] compaction: fix isolate_migratepages_block() for THP=n

On 27.4.2015 13:26, Kirill A. Shutemov wrote:
> PageTrans* helpers are always-false if THP is disabled compile-time.
> It means the fucntion will fail to detect hugetlb pages in this case.
> 
> Let's use PageCompound() instead. With small tweak to how we calculate
> next low_pfn it will make function ready to see tail pages.
> 
> Signed-off-by: Kirill A. Shutemov <kirill.shutemov@...ux.intel.com>

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

> ---
>  mm/compaction.c | 25 +++++++++++++------------
>  1 file changed, 13 insertions(+), 12 deletions(-)
> 
> diff --git a/mm/compaction.c b/mm/compaction.c
> index 018f08da99a2..6ef2fdf1d6b6 100644
> --- a/mm/compaction.c
> +++ b/mm/compaction.c
> @@ -732,18 +732,18 @@ isolate_migratepages_block(struct compact_control *cc, unsigned long low_pfn,
>  		 * splitting and collapsing (collapsing has already happened
>  		 * if PageLRU is set) but the lock is not necessarily taken
>  		 * here and it is wasteful to take it just to check transhuge.
> -		 * Check TransHuge without lock and skip the whole pageblock if
> -		 * it's either a transhuge or hugetlbfs page, as calling
> +		 * Check PageCompound without lock and skip the whole pageblock
> +		 * if it's either a transhuge or hugetlbfs page, as calling
>  		 * compound_order() without preventing THP from splitting the
>  		 * page underneath us may return surprising results.
>  		 */
> -		if (PageTransHuge(page)) {
> -			if (!locked)
> -				low_pfn = ALIGN(low_pfn + 1,
> -						pageblock_nr_pages) - 1;
> +		if (PageCompound(page)) {
> +			int nr;
> +			if (locked)
> +				nr = 1 << compound_order(page);
>  			else
> -				low_pfn += (1 << compound_order(page)) - 1;
> -
> +				nr = pageblock_nr_pages;
> +			low_pfn = ALIGN(low_pfn + 1, nr) - 1;
>  			continue;
>  		}
>  
> @@ -763,11 +763,12 @@ isolate_migratepages_block(struct compact_control *cc, unsigned long low_pfn,
>  			if (!locked)
>  				break;
>  
> -			/* Recheck PageLRU and PageTransHuge under lock */
> +			/* Recheck PageLRU and PageCompound under lock */
>  			if (!PageLRU(page))
>  				continue;
> -			if (PageTransHuge(page)) {
> -				low_pfn += (1 << compound_order(page)) - 1;
> +			if (PageCompound(page)) {
> +				int nr = 1 << compound_order(page);
> +				low_pfn = ALIGN(low_pfn + 1, nr) - 1;
>  				continue;
>  			}
>  		}
> @@ -778,7 +779,7 @@ isolate_migratepages_block(struct compact_control *cc, unsigned long low_pfn,
>  		if (__isolate_lru_page(page, isolate_mode) != 0)
>  			continue;
>  
> -		VM_BUG_ON_PAGE(PageTransCompound(page), page);
> +		VM_BUG_ON_PAGE(PageCompound(page), page);
>  
>  		/* Successfully isolated */
>  		del_page_from_lru_list(page, lruvec, page_lru(page));
> 

--
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