linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrea Arcangeli <aarcange@redhat.com>
To: akpm@linux-foundation.org
Cc: linux-mm@kvack.org,
	Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Subject: Re: + thp-compound_trans_order.patch added to -mm tree
Date: Wed, 22 Dec 2010 11:32:52 +0100	[thread overview]
Message-ID: <20101222103252.GJ26084@random.random> (raw)
In-Reply-To: <201012152358.oBFNwLn7013706@imap1.linux-foundation.org>

Hello Andrew,

here an incremental cleanup for this patch (it'd become
thp-compound_trans_order-fix.patch):

=====
Subject: thp: memcg: remove unnecessary compound_trans_order

From: Andrea Arcangeli <aarcange@redhat.com>

In these places PageTransHuge must not go away under memcg, as the page is
owned by the thread handling it. Add VM_BUG_ON and remove a superflous
page_size variable.

compound_trans_order for now remains for memory-failure.c, which later has to
be fixed to implement a safe compound_head too, that isn't safe right now.

Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>
---

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -1027,10 +1027,6 @@ mem_cgroup_get_reclaim_stat_from_page(st
 {
 	struct page_cgroup *pc;
 	struct mem_cgroup_per_zone *mz;
-	int page_size = PAGE_SIZE;
-
-	if (PageTransHuge(page))
-		page_size <<= compound_trans_order(page);
 
 	if (mem_cgroup_disabled())
 		return NULL;
@@ -2287,8 +2283,10 @@ static int mem_cgroup_charge_common(stru
 	int ret;
 	int page_size = PAGE_SIZE;
 
-	if (PageTransHuge(page))
-		page_size <<= compound_trans_order(page);
+	if (PageTransHuge(page)) {
+		page_size <<= compound_order(page);
+		VM_BUG_ON(!PageTransHuge(page));
+	}
 
 	pc = lookup_page_cgroup(page);
 	/* can happen at boot */
@@ -2559,8 +2557,10 @@ __mem_cgroup_uncharge_common(struct page
 	if (PageSwapCache(page))
 		return NULL;
 
-	if (PageTransHuge(page))
-		page_size <<= compound_trans_order(page);
+	if (PageTransHuge(page)) {
+		page_size <<= compound_order(page);
+		VM_BUG_ON(!PageTransHuge(page));
+	}
 
 	count = page_size >> PAGE_SHIFT;
 	/*


On Wed, Dec 15, 2010 at 03:58:21PM -0800, Andrew Morton wrote:
> 
> The patch titled
>      thp: compound_trans_order
> has been added to the -mm tree.  Its filename is
>      thp-compound_trans_order.patch
> 

--
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/ .
Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

           reply	other threads:[~2010-12-22 10:32 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <201012152358.oBFNwLn7013706@imap1.linux-foundation.org>]

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=20101222103252.GJ26084@random.random \
    --to=aarcange@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=linux-mm@kvack.org \
    --cc=nishimura@mxp.nes.nec.co.jp \
    /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;
as well as URLs for NNTP newsgroup(s).