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] [day] [month] [year] [list]
Date:	Wed, 30 Apr 2014 23:54:08 +0300
From:	"Kirill A. Shutemov" <kirill@...temov.name>
To:	Jianyu Zhan <nasa4836@...il.com>
Cc:	akpm@...ux-foundation.org, hannes@...xchg.org, riel@...hat.com,
	mgorman@...e.de, aarcange@...hat.com, linux-mm@...ck.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/3] mm/swap.c: split put_compound_page function

On Tue, Apr 29, 2014 at 05:42:28PM +0800, Jianyu Zhan wrote:
> Currently, put_compound_page should carefully handle tricky case
> to avoid racing with compound page releasing or spliting, which
> makes it growing quite lenthy(about 200+ lines) and need deep
> tab indention, which makes it quite hard to follow and maintain.
> 
> Now based on two helpers introduced in the previous patch
> ("mm/swap.c: introduce put_[un]refcounted_compound_page helpers
> for spliting put_compound_page"), this patch just replaces those
> two lenthy code path with these two helpers, respectively.
> Also, it has some comment rephrasing.
> 
> After this patch, the put_compound_page() will be very compact,
> thus easy to read and maintain.
> 
> After spliting, the object file is of same size as the original one.
> Actually, I've diff'ed put_compound_page()'s orginal disassemble code
> and the patched disassemble code, the are 100% the same!
> 
> This fact shows that this spliting has no functinal change,
> but it brings readability.
> 
> This patch and the previous one blow the code by 32 lines, which
> mostly credits to comments.
> 
> Signed-off-by: Jianyu Zhan <nasa4836@...il.com>
> ---
>  mm/swap.c | 142 +++++++-------------------------------------------------------
>  1 file changed, 16 insertions(+), 126 deletions(-)
> 
> diff --git a/mm/swap.c b/mm/swap.c
> index a576449..d8654d8 100644
> --- a/mm/swap.c
> +++ b/mm/swap.c
> @@ -225,6 +225,11 @@ static void put_compound_page(struct page *page)
>  {
>  	struct page *page_head;
>  
> +	/*
> +	 * We see the PageCompound set and PageTail not set, so @page maybe:
> +	 *  1. hugetlbfs head page, or
> +	 *  2. THP head page.

3. Head of slab compound page.

> +	 */
>  	if (likely(!PageTail(page))) {
>  		if (put_page_testzero(page)) {
>  			/*
> @@ -239,135 +244,20 @@ static void put_compound_page(struct page *page)
>  		return;
>  	}
>  

...

> +	 * We see the PageCompound set and PageTail set, so @page maybe:
> +	 *  1. a tail hugetlbfs page, or
> +	 *  2. a tail THP page, or
> +	 *  3. a split THP page.

4. Tail of slab compound page

-- 
 Kirill A. Shutemov
--
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