linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
To: Minchan Kim <minchan.kim@gmail.com>
Cc: Andrew Lutomirski <luto@mit.edu>,
	KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
	fengguang.wu@intel.com, andi@firstfloor.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org, mgorman@suse.de,
	hannes@cmpxchg.org, riel@redhat.com
Subject: Re: Kernel falls apart under light memory pressure (i.e. linking vmlinux)
Date: Fri, 20 May 2011 14:08:56 +0900	[thread overview]
Message-ID: <20110520140856.fdf4d1c8.kamezawa.hiroyu@jp.fujitsu.com> (raw)
In-Reply-To: <BANLkTins7qxWVh0bEwtk1Vx+m98N=oYVtw@mail.gmail.com>

On Fri, 20 May 2011 13:20:15 +0900
Minchan Kim <minchan.kim@gmail.com> wrote:

> So I want to resolve your problem asap.
> We don't have see report about that. Could you do git-bisect?
> FYI, Recently, big change of mm is compaction,transparent huge pages.
> Kame, could you point out thing related to memcg if you have a mind?
> 

I don't doubt memcg at this stage because it never modify page->flags.
Consdering the case, PageActive() is set against off-LRU pages after
clear_active_flags() clears it.

Hmm, I think I don't understand the lock system fully but...how do you
think this ?

==

At splitting a hugepage, the routine marks all pmd as "splitting".

But assume a racy case where 2 threads run into spit at the
same time, one thread wins compound_lock() and do split, another
thread should not touch splitted pages.

Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Index: mmotm-May11/mm/huge_memory.c
===================================================================
--- mmotm-May11.orig/mm/huge_memory.c
+++ mmotm-May11/mm/huge_memory.c
@@ -1150,7 +1150,7 @@ static int __split_huge_page_splitting(s
 	return ret;
 }
 
-static void __split_huge_page_refcount(struct page *page)
+static bool __split_huge_page_refcount(struct page *page)
 {
 	int i;
 	unsigned long head_index = page->index;
@@ -1161,6 +1161,11 @@ static void __split_huge_page_refcount(s
 	spin_lock_irq(&zone->lru_lock);
 	compound_lock(page);
 
+	if (!PageCompound(page)) {
+		compound_unlock(page);
+		spin_unlock_irq(&zone->lru_lock);
+		return false;
+	}
 	for (i = 1; i < HPAGE_PMD_NR; i++) {
 		struct page *page_tail = page + i;
 
@@ -1258,6 +1263,7 @@ static void __split_huge_page_refcount(s
 	 * to be pinned by the caller.
 	 */
 	BUG_ON(page_count(page) <= 0);
+	return true;
 }
 
 static int __split_huge_page_map(struct page *page,
@@ -1367,7 +1373,8 @@ static void __split_huge_page(struct pag
 		       mapcount, page_mapcount(page));
 	BUG_ON(mapcount != page_mapcount(page));
 
-	__split_huge_page_refcount(page);
+	if (!__split_huge_page_refcount(page))
+		return;
 
 	mapcount2 = 0;
 	list_for_each_entry(avc, &anon_vma->head, same_anon_vma) {

--
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 internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2011-05-20  5:15 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <BANLkTi=XqROAp2MOgwQXEQjdkLMenh_OTQ@mail.gmail.com>
     [not found] ` <m2fwokj0oz.fsf@firstfloor.org>
     [not found]   ` <BANLkTikhj1C7+HXP_4T-VnJzPefU2d7b3A@mail.gmail.com>
     [not found]     ` <20110512054631.GI6008@one.firstfloor.org>
     [not found]       ` <BANLkTi=fk3DUT9cYd2gAzC98c69F6HXX7g@mail.gmail.com>
2011-05-14 15:46         ` Andrew Lutomirski
2011-05-14 16:53           ` Andi Kleen
     [not found]             ` <BANLkTik6SS9NH7XVSRBoCR16_5veY0MKBw@mail.gmail.com>
2011-05-14 17:43               ` Andi Kleen
2011-05-15  1:37                 ` Minchan Kim
2011-05-15 15:27                   ` Wu Fengguang
2011-05-15 15:59                     ` Andrew Lutomirski
2011-05-15 22:58                       ` Minchan Kim
2011-05-16  8:51                         ` Mel Gorman
2011-05-15 16:12                     ` Andrew Lutomirski
2011-05-17  6:00                       ` Wu Fengguang
2011-05-17  6:35                         ` Minchan Kim
2011-05-17 19:22                         ` Andrew Lutomirski
2011-05-18  5:17                           ` Minchan Kim
2011-05-19  2:15                             ` Andrew Lutomirski
2011-05-19  2:30                               ` KAMEZAWA Hiroyuki
2011-05-19  2:41                                 ` Andrew Lutomirski
2011-05-19  2:54                               ` Minchan Kim
2011-05-19 14:16                                 ` Andrew Lutomirski
2011-05-20  0:17                                   ` Minchan Kim
2011-05-20  2:58                                   ` Andrew Lutomirski
2011-05-20  3:12                                     ` KOSAKI Motohiro
2011-05-20  3:38                                       ` Andrew Lutomirski
2011-05-20  4:20                                         ` Minchan Kim
2011-05-20  5:08                                           ` KAMEZAWA Hiroyuki [this message]
2011-05-20  5:36                                             ` Minchan Kim
2011-05-20  7:43                                               ` KAMEZAWA Hiroyuki
2011-05-20 10:11                                             ` Andrea Arcangeli
2011-05-20 14:11                                               ` Andrew Lutomirski
2011-05-20 15:33                                                 ` Minchan Kim
2011-05-20 16:01                                                   ` Andrew Lutomirski
2011-05-20 16:19                                                     ` Minchan Kim
2011-05-20 18:09                                                       ` Andrew Lutomirski
2011-05-20 18:40                                                         ` Andrew Lutomirski
2011-05-21 12:04                                                         ` KOSAKI Motohiro
2011-05-21 13:34                                                           ` Andrew Lutomirski
2011-05-21 14:14                                                             ` KOSAKI Motohiro
2011-05-21 14:44                                                             ` Minchan Kim
2011-05-22 12:22                                                               ` Andrew Lutomirski
2011-05-22 23:12                                                                 ` Minchan Kim
2011-05-23 16:42                                                                   ` Andrea Arcangeli
2011-05-23 17:35                                                                     ` Mel Gorman
2011-05-24  1:19                                                                   ` Andrew Lutomirski
2011-05-24  1:34                                                                     ` Minchan Kim
2011-05-24 11:24                                                                       ` Andrew Lutomirski
2011-05-24 11:55                                                                         ` Andrew Lutomirski
2011-05-25  0:43                                                                           ` KOSAKI Motohiro
2011-05-21 14:31                                                           ` Minchan Kim
2011-05-19 14:51                             ` Wu Fengguang
2011-05-19 15:00                               ` Andrew Lutomirski
2011-05-20  0:20                               ` Minchan Kim
2011-05-15 22:40                     ` Minchan Kim
2011-05-17  5:52                       ` Wu Fengguang
2011-05-17  6:26                         ` Minchan Kim

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=20110520140856.fdf4d1c8.kamezawa.hiroyu@jp.fujitsu.com \
    --to=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=andi@firstfloor.org \
    --cc=fengguang.wu@intel.com \
    --cc=hannes@cmpxchg.org \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=luto@mit.edu \
    --cc=mgorman@suse.de \
    --cc=minchan.kim@gmail.com \
    --cc=riel@redhat.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