All of lore.kernel.org
 help / color / mirror / Atom feed
From: Minchan Kim <minchan.kim@gmail.com>
To: Christoph Lameter <cl@linux-foundation.org>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
	Milton Miller <miltonm@bga.com>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Russell King <linux@arm.linux.org.uk>, Mel Gorman <mel@csn.ul.ie>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Kukjin Kim <kgene.kim@samsung.com>
Subject: Re: [PATCH] Tight check of pfn_valid on sparsemem - v4
Date: Fri, 30 Jul 2010 01:18:56 +0900	[thread overview]
Message-ID: <20100729161856.GA16420@barrios-desktop> (raw)
In-Reply-To: <alpine.DEB.2.00.1007291038100.16510@router.home>

On Thu, Jul 29, 2010 at 10:46:13AM -0500, Christoph Lameter wrote:
> On Thu, 29 Jul 2010, Minchan Kim wrote:
> 
> > On Wed, Jul 28, 2010 at 12:02:16PM -0500, Christoph Lameter wrote:
> > > On Thu, 29 Jul 2010, Minchan Kim wrote:
> > > > invalid memmap pages will be freed by free_memmap and will be used
> > > > on any place. How do we make sure it has PG_reserved?
> > >
> > > Not present memmap pages make pfn_valid fail already since there is no
> > > entry for the page table (vmemmap) or blocks are missing in the sparsemem
> > > tables.
> > >
> > > > Maybe I don't understand your point.
> > >
> > > I thought we are worrying about holes in the memmap blocks containing page
> > > structs. Some page structs point to valid pages and some are not. The
> > > invalid page structs need to be marked consistently to allow the check.
> >
> > The thing is that memmap pages which contains struct page array on hole will be
> > freed by free_memmap in ARM. Please loot at arch/arm/mm/init.c.
> > And it will be used by page allocator as free pages.
> 
> Arg thats the solution to the mystery. freememmap() is arm specific hack!
> 
> Sparsemem allows you to properly handle holes already and then pfn_valid
> will work correctly.
> 
> Why are the ways to manage holes in the core not used by arm?

I did use ARCH_HAS_HOLES_MEMORYMODEL.
It is used by only ARM now. 
If you disable the config, it doesn't affect the core. 

> 
> sparsemem does a table lookup to determine valid and invalid sections of
> the memmp.
> 
The thing is valid section also have a invalid memmap. 
Maybe my description isn't enough. 
Please look at description and following URL. 

We already confirmed this problem. 
http://www.spinics.net/lists/arm-kernel/msg92918.html

== CUT HERE ==

Kukjin reported oops happen while he change min_free_kbytes
http://www.spinics.net/lists/arm-kernel/msg92894.html
It happen by memory map on sparsemem.

The system has a memory map following as.
     section 0             section 1              section 2
     0x20000000-0x25000000, 0x40000000-0x50000000, 0x50000000-0x58000000
     SECTION_SIZE_BITS 28(256M)

     It means section 0 is an incompletely filled section.
     Nontheless, current pfn_valid of sparsemem checks pfn loosely.
     It checks only mem_section's validation but ARM can free mem_map on hole
     to save memory space. So in above case, pfn on 0x25000000 can pass pfn_valid's
     validation check. It's not what we want.




-- 
Kind regards,
Minchan Kim

WARNING: multiple messages have this Message-ID (diff)
From: Minchan Kim <minchan.kim@gmail.com>
To: Christoph Lameter <cl@linux-foundation.org>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
	Milton Miller <miltonm@bga.com>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Russell King <linux@arm.linux.org.uk>, Mel Gorman <mel@csn.ul.ie>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Kukjin Kim <kgene.kim@samsung.com>
Subject: Re: [PATCH] Tight check of pfn_valid on sparsemem - v4
Date: Fri, 30 Jul 2010 01:18:56 +0900	[thread overview]
Message-ID: <20100729161856.GA16420@barrios-desktop> (raw)
In-Reply-To: <alpine.DEB.2.00.1007291038100.16510@router.home>

On Thu, Jul 29, 2010 at 10:46:13AM -0500, Christoph Lameter wrote:
> On Thu, 29 Jul 2010, Minchan Kim wrote:
> 
> > On Wed, Jul 28, 2010 at 12:02:16PM -0500, Christoph Lameter wrote:
> > > On Thu, 29 Jul 2010, Minchan Kim wrote:
> > > > invalid memmap pages will be freed by free_memmap and will be used
> > > > on any place. How do we make sure it has PG_reserved?
> > >
> > > Not present memmap pages make pfn_valid fail already since there is no
> > > entry for the page table (vmemmap) or blocks are missing in the sparsemem
> > > tables.
> > >
> > > > Maybe I don't understand your point.
> > >
> > > I thought we are worrying about holes in the memmap blocks containing page
> > > structs. Some page structs point to valid pages and some are not. The
> > > invalid page structs need to be marked consistently to allow the check.
> >
> > The thing is that memmap pages which contains struct page array on hole will be
> > freed by free_memmap in ARM. Please loot at arch/arm/mm/init.c.
> > And it will be used by page allocator as free pages.
> 
> Arg thats the solution to the mystery. freememmap() is arm specific hack!
> 
> Sparsemem allows you to properly handle holes already and then pfn_valid
> will work correctly.
> 
> Why are the ways to manage holes in the core not used by arm?

I did use ARCH_HAS_HOLES_MEMORYMODEL.
It is used by only ARM now. 
If you disable the config, it doesn't affect the core. 

> 
> sparsemem does a table lookup to determine valid and invalid sections of
> the memmp.
> 
The thing is valid section also have a invalid memmap. 
Maybe my description isn't enough. 
Please look at description and following URL. 

We already confirmed this problem. 
http://www.spinics.net/lists/arm-kernel/msg92918.html

== CUT HERE ==

Kukjin reported oops happen while he change min_free_kbytes
http://www.spinics.net/lists/arm-kernel/msg92894.html
It happen by memory map on sparsemem.

The system has a memory map following as.
     section 0             section 1              section 2
     0x20000000-0x25000000, 0x40000000-0x50000000, 0x50000000-0x58000000
     SECTION_SIZE_BITS 28(256M)

     It means section 0 is an incompletely filled section.
     Nontheless, current pfn_valid of sparsemem checks pfn loosely.
     It checks only mem_section's validation but ARM can free mem_map on hole
     to save memory space. So in above case, pfn on 0x25000000 can pass pfn_valid's
     validation check. It's not what we want.




-- 
Kind regards,
Minchan Kim

--
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:[~2010-07-29 16:19 UTC|newest]

Thread overview: 72+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-26 15:46 [PATCH] Tight check of pfn_valid on sparsemem - v4 Minchan Kim
2010-07-26 15:46 ` Minchan Kim
2010-07-26 15:46 ` Minchan Kim
2010-07-26 16:40 ` Christoph Lameter
2010-07-26 16:40   ` Christoph Lameter
2010-07-26 16:40   ` Christoph Lameter
2010-07-26 22:47   ` Minchan Kim
2010-07-26 22:47     ` Minchan Kim
2010-07-26 22:47     ` Minchan Kim
2010-07-27  5:55   ` miltonm
2010-07-27  5:55     ` miltonm
2010-07-27  6:11     ` Minchan Kim
2010-07-27  8:12       ` Milton Miller
2010-07-27  8:12         ` Milton Miller
2010-07-27  8:13         ` KAMEZAWA Hiroyuki
2010-07-27  8:13           ` KAMEZAWA Hiroyuki
2010-07-27 10:01           ` Minchan Kim
2010-07-27 10:01             ` Minchan Kim
2010-07-27 14:34             ` Christoph Lameter
2010-07-27 14:34               ` Christoph Lameter
2010-07-27 22:33               ` Minchan Kim
2010-07-27 22:33                 ` Minchan Kim
2010-07-28 15:14                 ` Christoph Lameter
2010-07-28 15:14                   ` Christoph Lameter
2010-07-28 15:56                   ` Minchan Kim
2010-07-28 15:56                     ` Minchan Kim
2010-07-28 17:02                     ` Christoph Lameter
2010-07-28 17:02                       ` Christoph Lameter
2010-07-28 22:57                       ` Minchan Kim
2010-07-28 22:57                         ` Minchan Kim
2010-07-29 15:46                         ` Christoph Lameter
2010-07-29 15:46                           ` Christoph Lameter
2010-07-29 16:18                           ` Minchan Kim [this message]
2010-07-29 16:18                             ` Minchan Kim
2010-07-29 16:47                             ` Christoph Lameter
2010-07-29 16:47                               ` Christoph Lameter
2010-07-29 17:03                               ` Minchan Kim
2010-07-29 17:03                                 ` Minchan Kim
2010-07-29 17:30                                 ` Christoph Lameter
2010-07-29 17:30                                   ` Christoph Lameter
2010-07-29 18:33                                   ` Russell King - ARM Linux
2010-07-29 18:33                                     ` Russell King - ARM Linux
2010-07-29 19:55                                     ` Christoph Lameter
2010-07-29 19:55                                       ` Christoph Lameter
2010-07-29 21:13                                       ` Russell King - ARM Linux
2010-07-29 21:13                                         ` Russell King - ARM Linux
2010-07-29 20:55                                     ` Dave Hansen
2010-07-29 20:55                                       ` Dave Hansen
2010-07-29 22:14                                       ` Russell King - ARM Linux
2010-07-29 22:14                                         ` Russell King - ARM Linux
2010-07-29 22:28                                         ` Christoph Lameter
2010-07-29 22:28                                           ` Christoph Lameter
2010-07-30  0:38                                         ` Dave Hansen
2010-07-30  0:38                                           ` Dave Hansen
2010-07-30  9:43                                           ` Minchan Kim
2010-07-30  9:43                                             ` Minchan Kim
2010-07-30 12:48                                           ` Christoph Lameter
2010-07-30 12:48                                             ` Christoph Lameter
2010-07-30 15:43                                             ` Dave Hansen
2010-07-30 15:43                                               ` Dave Hansen
2010-07-31 15:30                                             ` Russell King - ARM Linux
2010-07-31 15:30                                               ` Russell King - ARM Linux
2010-08-02 15:48                                               ` Christoph Lameter
2010-08-02 15:48                                                 ` Christoph Lameter
2010-07-30  9:32                                       ` Minchan Kim
2010-07-30  9:32                                         ` Minchan Kim
2010-07-31 10:38                                         ` Russell King - ARM Linux
2010-07-31 10:38                                           ` Russell King - ARM Linux
2010-08-11 15:31                                           ` Dave Hansen
2010-08-11 15:31                                             ` Dave Hansen
2010-07-27  9:56         ` Minchan Kim
2010-07-27  9:56           ` 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=20100729161856.GA16420@barrios-desktop \
    --to=minchan.kim@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=cl@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=kgene.kim@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux@arm.linux.org.uk \
    --cc=mel@csn.ul.ie \
    --cc=miltonm@bga.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.