linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@suse.cz>
To: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Hugh Dickins <hughd@google.com>, Mel Gorman <mgorman@suse.de>,
	Johannes Weiner <hannes@cmpxchg.org>,
	David Rientjes <rientjes@google.com>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Naoya Horiguchi <nao.horiguchi@gmail.com>
Subject: Re: [PATCH v3 1/3] mm: don't call __page_cache_release for hugetlb
Date: Wed, 1 Apr 2015 18:13:58 +0200	[thread overview]
Message-ID: <20150401161358.GA12808@dhcp22.suse.cz> (raw)
In-Reply-To: <1427791840-11247-2-git-send-email-n-horiguchi@ah.jp.nec.com>

On Tue 31-03-15 08:50:45, Naoya Horiguchi wrote:
> __put_compound_page() calls __page_cache_release() to do some freeing works,
> but it's obviously for thps, not for hugetlb. We didn't care it because PageLRU
> is always cleared and page->mem_cgroup is always NULL for hugetlb.
> But it's not correct and has potential risks, so let's make it conditional.
> 
> Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>

Reviewed-by: Michal Hocko <mhocko@suse.cz>

> ---
>  mm/swap.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git v4.0-rc6.orig/mm/swap.c v4.0-rc6/mm/swap.c
> index cd3a5e64cea9..8e46823c3319 100644
> --- v4.0-rc6.orig/mm/swap.c
> +++ v4.0-rc6/mm/swap.c
> @@ -31,6 +31,7 @@
>  #include <linux/memcontrol.h>
>  #include <linux/gfp.h>
>  #include <linux/uio.h>
> +#include <linux/hugetlb.h>
>  
>  #include "internal.h"
>  
> @@ -75,7 +76,14 @@ static void __put_compound_page(struct page *page)
>  {
>  	compound_page_dtor *dtor;
>  
> -	__page_cache_release(page);
> +	/*
> +	 * __page_cache_release() is supposed to be called for thp, not for
> +	 * hugetlb. This is because hugetlb page does never have PageLRU set
> +	 * (it's never listed to any LRU lists) and no memcg routines should
> +	 * be called for hugetlb (it has a separate hugetlb_cgroup.)
> +	 */
> +	if (!PageHuge(page))
> +		__page_cache_release(page);
>  	dtor = get_compound_page_dtor(page);
>  	(*dtor)(page);
>  }
> -- 
> 1.9.3

-- 
Michal Hocko
SUSE Labs

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2015-04-01 16:14 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-31  8:50 [PATCH 0/3] hugetlb fixlet v3 Naoya Horiguchi
2015-03-31  8:50 ` [PATCH v3 1/3] mm: don't call __page_cache_release for hugetlb Naoya Horiguchi
2015-04-01 16:13   ` Michal Hocko [this message]
2015-03-31  8:50 ` [PATCH v3 3/3] mm: hugetlb: cleanup using PageHugeActive flag Naoya Horiguchi
2015-03-31 21:08   ` Andrew Morton
2015-04-01  3:27     ` Naoya Horiguchi
2015-04-01 16:36   ` Michal Hocko
2015-03-31  8:50 ` [PATCH v3 2/3] mm: hugetlb: introduce " Naoya Horiguchi
2015-03-31 21:06   ` Andrew Morton
2015-04-01  1:40     ` Naoya Horiguchi
2015-04-01 16:30   ` Michal Hocko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150401161358.GA12808@dhcp22.suse.cz \
    --to=mhocko@suse.cz \
    --cc=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=hughd@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@suse.de \
    --cc=n-horiguchi@ah.jp.nec.com \
    --cc=nao.horiguchi@gmail.com \
    --cc=rientjes@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox