Re: [PATCH 2/2] mm/page_alloc: DEBUG_VM checks for free_list placement of CMA and RESERVE pages

2014-05-14 Thread Vlastimil Babka

On 05/14/2014 07:19 AM, Hugh Dickins wrote:

On Tue, 13 May 2014, Sasha Levin wrote:

On 05/05/2014 11:50 AM, Vlastimil Babka wrote:

So in the end this VM_DEBUG check probably cannot work anymore for 
MIGRATE_RESERVE, only for CMA. I'm not sure if it's worth keeping it only for 
CMA, what are the CMA guys' opinions on that?


The way I understood it is that this patch is wrong, but it's still
alive in -mm. Should it still be there?


I agree that it should be dropped.  I did not follow the discussion,
but mmotm soon gives me BUG at mm/page_alloc.c:1242 under swapping load.


Yes, I have already asked for dropping, and updating message of PATCH 
1/2 at http://marc.info/?l=linux-mm=139947475413079=2


Vlastimil


Hugh



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/2] mm/page_alloc: DEBUG_VM checks for free_list placement of CMA and RESERVE pages

2014-05-14 Thread Vlastimil Babka

On 05/14/2014 07:19 AM, Hugh Dickins wrote:

On Tue, 13 May 2014, Sasha Levin wrote:

On 05/05/2014 11:50 AM, Vlastimil Babka wrote:

So in the end this VM_DEBUG check probably cannot work anymore for 
MIGRATE_RESERVE, only for CMA. I'm not sure if it's worth keeping it only for 
CMA, what are the CMA guys' opinions on that?


The way I understood it is that this patch is wrong, but it's still
alive in -mm. Should it still be there?


I agree that it should be dropped.  I did not follow the discussion,
but mmotm soon gives me BUG at mm/page_alloc.c:1242 under swapping load.


Yes, I have already asked for dropping, and updating message of PATCH 
1/2 at http://marc.info/?l=linux-mmm=139947475413079w=2


Vlastimil


Hugh



--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/2] mm/page_alloc: DEBUG_VM checks for free_list placement of CMA and RESERVE pages

2014-05-13 Thread Hugh Dickins
On Tue, 13 May 2014, Sasha Levin wrote:
> On 05/05/2014 11:50 AM, Vlastimil Babka wrote:
> > So in the end this VM_DEBUG check probably cannot work anymore for 
> > MIGRATE_RESERVE, only for CMA. I'm not sure if it's worth keeping it only 
> > for CMA, what are the CMA guys' opinions on that?
> 
> The way I understood it is that this patch is wrong, but it's still
> alive in -mm. Should it still be there?

I agree that it should be dropped.  I did not follow the discussion,
but mmotm soon gives me BUG at mm/page_alloc.c:1242 under swapping load.

Hugh
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/2] mm/page_alloc: DEBUG_VM checks for free_list placement of CMA and RESERVE pages

2014-05-13 Thread Sasha Levin
On 05/05/2014 11:50 AM, Vlastimil Babka wrote:
> So in the end this VM_DEBUG check probably cannot work anymore for 
> MIGRATE_RESERVE, only for CMA. I'm not sure if it's worth keeping it only for 
> CMA, what are the CMA guys' opinions on that?

The way I understood it is that this patch is wrong, but it's still
alive in -mm. Should it still be there?


Thanks,
Sasha
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/2] mm/page_alloc: DEBUG_VM checks for free_list placement of CMA and RESERVE pages

2014-05-13 Thread Sasha Levin
On 05/05/2014 11:50 AM, Vlastimil Babka wrote:
 So in the end this VM_DEBUG check probably cannot work anymore for 
 MIGRATE_RESERVE, only for CMA. I'm not sure if it's worth keeping it only for 
 CMA, what are the CMA guys' opinions on that?

The way I understood it is that this patch is wrong, but it's still
alive in -mm. Should it still be there?


Thanks,
Sasha
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/2] mm/page_alloc: DEBUG_VM checks for free_list placement of CMA and RESERVE pages

2014-05-13 Thread Hugh Dickins
On Tue, 13 May 2014, Sasha Levin wrote:
 On 05/05/2014 11:50 AM, Vlastimil Babka wrote:
  So in the end this VM_DEBUG check probably cannot work anymore for 
  MIGRATE_RESERVE, only for CMA. I'm not sure if it's worth keeping it only 
  for CMA, what are the CMA guys' opinions on that?
 
 The way I understood it is that this patch is wrong, but it's still
 alive in -mm. Should it still be there?

I agree that it should be dropped.  I did not follow the discussion,
but mmotm soon gives me BUG at mm/page_alloc.c:1242 under swapping load.

Hugh
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/2] mm/page_alloc: DEBUG_VM checks for free_list placement of CMA and RESERVE pages

2014-05-12 Thread Joonsoo Kim
On Thu, May 08, 2014 at 03:34:33PM -0700, Andrew Morton wrote:
> On Thu, 8 May 2014 15:19:37 +0900 Minchan Kim  wrote:
> 
> > > I also think that VM_DEBUG overhead isn't problem because of same
> > > reason from Vlastimil.
> > 
> > Guys, please read this.
> > 
> > https://lkml.org/lkml/2013/7/17/591
> > 
> > If you guys really want it, we could separate it with
> > CONFIG_DEBUG_CMA or CONFIG_DEBUG_RESERVE like stuff.
> > Otherwise, just remain in mmotm.
> 
> Wise words, those.
> 
> Yes, these checks are in a pretty hot path.  I'm inclined to make the
> patch -mm (and -next) only.
> 
> Unless there's a really good reason, such as "nobody who uses CMA is
> likely to be testing -next", which sounds likely :(

Hello,

Now, I think that dropping this patch is better if we can only use it
on MIGRATE_CMA case. Later, if I feel that this case should be checked,
I will resend the patch with appropriate argument.

Thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/2] mm/page_alloc: DEBUG_VM checks for free_list placement of CMA and RESERVE pages

2014-05-12 Thread Joonsoo Kim
On Mon, May 12, 2014 at 10:28:25AM +0200, Vlastimil Babka wrote:
> On 05/08/2014 07:54 AM, Joonsoo Kim wrote:
> >On Wed, May 07, 2014 at 04:59:07PM +0200, Vlastimil Babka wrote:
> >>On 05/07/2014 03:33 AM, Minchan Kim wrote:
> >>>On Mon, May 05, 2014 at 05:50:46PM +0200, Vlastimil Babka wrote:
> On 05/05/2014 04:36 PM, Sasha Levin wrote:
> >On 05/02/2014 08:08 AM, Vlastimil Babka wrote:
> >>On 04/30/2014 11:46 PM, Sasha Levin wrote:
> On 04/03/2014 11:40 AM, Vlastimil Babka wrote:
> >>For the MIGRATE_RESERVE pages, it is important they do not get 
> >>misplaced
> >>on free_list of other migratetype, otherwise the whole 
> >>MIGRATE_RESERVE
> >>pageblock might be changed to other migratetype in 
> >>try_to_steal_freepages().
> >>For MIGRATE_CMA, the pages also must not go to a different 
> >>free_list, otherwise
> >>they could get allocated as unmovable and result in CMA failure.
> >>
> >>This is ensured by setting the freepage_migratetype appropriately 
> >>when placing
> >>pages on pcp lists, and using the information when releasing them 
> >>back to
> >>free_list. It is also assumed that CMA and RESERVE pageblocks are 
> >>created only
> >>in the init phase. This patch adds DEBUG_VM checks to catch any 
> >>regressions
> >>introduced for this invariant.
> >>
> >>Cc: Yong-Taek Lee 
> >>Cc: Bartlomiej Zolnierkiewicz 
> >>Cc: Joonsoo Kim 
> >>Cc: Mel Gorman 
> >>Cc: Minchan Kim 
> >>Cc: KOSAKI Motohiro 
> >>Cc: Marek Szyprowski 
> >>Cc: Hugh Dickins 
> >>Cc: Rik van Riel 
> >>Cc: Michal Nazarewicz 
> >>Signed-off-by: Vlastimil Babka 
> 
> Two issues with this patch.
> 
> First:
> 
> [ 3446.320082] kernel BUG at mm/page_alloc.c:1197!
> [ 3446.320082] invalid opcode:  [#1] PREEMPT SMP DEBUG_PAGEALLOC
> [ 3446.320082] Dumping ftrace buffer:
> [ 3446.320082](ftrace buffer empty)
> [ 3446.320082] Modules linked in:
> [ 3446.320082] CPU: 1 PID: 8923 Comm: trinity-c42 Not tainted 
> 3.15.0-rc3-next-20140429-sasha-00015-g7c7e0a7-dirty #427
> [ 3446.320082] task: 88053e208000 ti: 88053e246000 task.ti: 
> 88053e246000
> [ 3446.320082] RIP: get_page_from_freelist (mm/page_alloc.c:1197 
> mm/page_alloc.c:1548 mm/page_alloc.c:2036)
> [ 3446.320082] RSP: 0018:88053e247778  EFLAGS: 00010002
> [ 3446.320082] RAX: 0003 RBX: eaf4 RCX: 
> 0008
> [ 3446.320082] RDX: 0002 RSI: 0003 RDI: 
> 00a0
> [ 3446.320082] RBP: 88053e247868 R08: 0007 R09: 
> 
> [ 3446.320082] R10: 88006ffcef00 R11:  R12: 
> 0014
> [ 3446.335888] R13: ea000115ffe0 R14: ea000115ffe0 R15: 
> 
> [ 3446.335888] FS:  7f8c9f059700() GS:88006ec0() 
> knlGS:
> [ 3446.335888] CS:  0010 DS:  ES:  CR0: 8005003b
> [ 3446.335888] CR2: 02cbc048 CR3: 00054cdb4000 CR4: 
> 06a0
> [ 3446.335888] DR0: 006de000 DR1: 006de000 DR2: 
> 
> [ 3446.335888] DR3:  DR6: 0ff0 DR7: 
> 0602
> [ 3446.335888] Stack:
> [ 3446.335888]  88053e247798 88006eddc0b8 0016 
> 
> [ 3446.335888]  88006ffd2068 88006ffdb008 0001 
> 
> [ 3446.335888]  88006ffdb000  0003 
> 0001
> [ 3446.335888] Call Trace:
> [ 3446.335888] __alloc_pages_nodemask (mm/page_alloc.c:2731)
> [ 3446.335888] ? __this_cpu_preempt_check (lib/smp_processor_id.c:63)
> [ 3446.335888] alloc_pages_vma (include/linux/mempolicy.h:76 
> mm/mempolicy.c:1998)
> [ 3446.335888] ? shmem_alloc_page (mm/shmem.c:881)
> [ 3446.335888] ? kvm_clock_read (arch/x86/include/asm/preempt.h:90 
> arch/x86/kernel/kvmclock.c:86)
> [ 3446.335888] shmem_alloc_page (mm/shmem.c:881)
> [ 3446.335888] ? __const_udelay (arch/x86/lib/delay.c:126)
> [ 3446.335888] ? __rcu_read_unlock (kernel/rcu/update.c:97)
> [ 3446.335888] ? find_get_entry (mm/filemap.c:979)
> [ 3446.335888] ? find_get_entry (mm/filemap.c:940)
> [ 3446.335888] ? find_lock_entry (mm/filemap.c:1024)
> [ 3446.335888] shmem_getpage_gfp (mm/shmem.c:1130)
> [ 3446.335888] ? sched_clock_local (kernel/sched/clock.c:214)
> [ 

Re: [PATCH 2/2] mm/page_alloc: DEBUG_VM checks for free_list placement of CMA and RESERVE pages

2014-05-12 Thread Vlastimil Babka

On 05/08/2014 07:54 AM, Joonsoo Kim wrote:

On Wed, May 07, 2014 at 04:59:07PM +0200, Vlastimil Babka wrote:

On 05/07/2014 03:33 AM, Minchan Kim wrote:

On Mon, May 05, 2014 at 05:50:46PM +0200, Vlastimil Babka wrote:

On 05/05/2014 04:36 PM, Sasha Levin wrote:

On 05/02/2014 08:08 AM, Vlastimil Babka wrote:

On 04/30/2014 11:46 PM, Sasha Levin wrote:

On 04/03/2014 11:40 AM, Vlastimil Babka wrote:

For the MIGRATE_RESERVE pages, it is important they do not get misplaced
on free_list of other migratetype, otherwise the whole MIGRATE_RESERVE
pageblock might be changed to other migratetype in try_to_steal_freepages().
For MIGRATE_CMA, the pages also must not go to a different free_list, otherwise
they could get allocated as unmovable and result in CMA failure.

This is ensured by setting the freepage_migratetype appropriately when placing
pages on pcp lists, and using the information when releasing them back to
free_list. It is also assumed that CMA and RESERVE pageblocks are created only
in the init phase. This patch adds DEBUG_VM checks to catch any regressions
introduced for this invariant.

Cc: Yong-Taek Lee 
Cc: Bartlomiej Zolnierkiewicz 
Cc: Joonsoo Kim 
Cc: Mel Gorman 
Cc: Minchan Kim 
Cc: KOSAKI Motohiro 
Cc: Marek Szyprowski 
Cc: Hugh Dickins 
Cc: Rik van Riel 
Cc: Michal Nazarewicz 
Signed-off-by: Vlastimil Babka 


Two issues with this patch.

First:

[ 3446.320082] kernel BUG at mm/page_alloc.c:1197!
[ 3446.320082] invalid opcode:  [#1] PREEMPT SMP DEBUG_PAGEALLOC
[ 3446.320082] Dumping ftrace buffer:
[ 3446.320082](ftrace buffer empty)
[ 3446.320082] Modules linked in:
[ 3446.320082] CPU: 1 PID: 8923 Comm: trinity-c42 Not tainted 
3.15.0-rc3-next-20140429-sasha-00015-g7c7e0a7-dirty #427
[ 3446.320082] task: 88053e208000 ti: 88053e246000 task.ti: 
88053e246000
[ 3446.320082] RIP: get_page_from_freelist (mm/page_alloc.c:1197 
mm/page_alloc.c:1548 mm/page_alloc.c:2036)
[ 3446.320082] RSP: 0018:88053e247778  EFLAGS: 00010002
[ 3446.320082] RAX: 0003 RBX: eaf4 RCX: 0008
[ 3446.320082] RDX: 0002 RSI: 0003 RDI: 00a0
[ 3446.320082] RBP: 88053e247868 R08: 0007 R09: 
[ 3446.320082] R10: 88006ffcef00 R11:  R12: 0014
[ 3446.335888] R13: ea000115ffe0 R14: ea000115ffe0 R15: 
[ 3446.335888] FS:  7f8c9f059700() GS:88006ec0() 
knlGS:
[ 3446.335888] CS:  0010 DS:  ES:  CR0: 8005003b
[ 3446.335888] CR2: 02cbc048 CR3: 00054cdb4000 CR4: 06a0
[ 3446.335888] DR0: 006de000 DR1: 006de000 DR2: 
[ 3446.335888] DR3:  DR6: 0ff0 DR7: 0602
[ 3446.335888] Stack:
[ 3446.335888]  88053e247798 88006eddc0b8 0016 

[ 3446.335888]  88006ffd2068 88006ffdb008 0001 

[ 3446.335888]  88006ffdb000  0003 
0001
[ 3446.335888] Call Trace:
[ 3446.335888] __alloc_pages_nodemask (mm/page_alloc.c:2731)
[ 3446.335888] ? __this_cpu_preempt_check (lib/smp_processor_id.c:63)
[ 3446.335888] alloc_pages_vma (include/linux/mempolicy.h:76 
mm/mempolicy.c:1998)
[ 3446.335888] ? shmem_alloc_page (mm/shmem.c:881)
[ 3446.335888] ? kvm_clock_read (arch/x86/include/asm/preempt.h:90 
arch/x86/kernel/kvmclock.c:86)
[ 3446.335888] shmem_alloc_page (mm/shmem.c:881)
[ 3446.335888] ? __const_udelay (arch/x86/lib/delay.c:126)
[ 3446.335888] ? __rcu_read_unlock (kernel/rcu/update.c:97)
[ 3446.335888] ? find_get_entry (mm/filemap.c:979)
[ 3446.335888] ? find_get_entry (mm/filemap.c:940)
[ 3446.335888] ? find_lock_entry (mm/filemap.c:1024)
[ 3446.335888] shmem_getpage_gfp (mm/shmem.c:1130)
[ 3446.335888] ? sched_clock_local (kernel/sched/clock.c:214)
[ 3446.335888] ? do_read_fault.isra.42 (mm/memory.c:3523)
[ 3446.335888] shmem_fault (mm/shmem.c:1237)
[ 3446.335888] ? do_read_fault.isra.42 (mm/memory.c:3523)
[ 3446.335888] __do_fault (mm/memory.c:3344)
[ 3446.335888] ? _raw_spin_unlock (arch/x86/include/asm/preempt.h:98 
include/linux/spinlock_api_smp.h:152 kernel/locking/spinlock.c:183)
[ 3446.335888] do_read_fault.isra.42 (mm/memory.c:3524)
[ 3446.335888] ? get_parent_ip (kernel/sched/core.c:2485)
[ 3446.335888] ? get_parent_ip (kernel/sched/core.c:2485)
[ 3446.335888] __handle_mm_fault (mm/memory.c:3662 mm/memory.c:3823 
mm/memory.c:3950)
[ 3446.335888] ? __const_udelay (arch/x86/lib/delay.c:126)
[ 3446.335888] ? __rcu_read_unlock (kernel/rcu/update.c:97)
[ 3446.335888] handle_mm_fault (mm/memory.c:3973)
[ 3446.335888] __get_user_pages (mm/memory.c:1863)
[ 3446.335888] ? preempt_count_sub (kernel/sched/core.c:2541)
[ 3446.335888] __mlock_vma_pages_range (mm/mlock.c:255)
[ 3446.335888] __mm_populate (mm/mlock.c:711)
[ 3446.335888] vm_mmap_pgoff (include/linux/mm.h:1841 mm/util.c:402)
[ 3446.335888] SyS_mmap_pgoff 

Re: [PATCH 2/2] mm/page_alloc: DEBUG_VM checks for free_list placement of CMA and RESERVE pages

2014-05-12 Thread Vlastimil Babka

On 05/08/2014 07:54 AM, Joonsoo Kim wrote:

On Wed, May 07, 2014 at 04:59:07PM +0200, Vlastimil Babka wrote:

On 05/07/2014 03:33 AM, Minchan Kim wrote:

On Mon, May 05, 2014 at 05:50:46PM +0200, Vlastimil Babka wrote:

On 05/05/2014 04:36 PM, Sasha Levin wrote:

On 05/02/2014 08:08 AM, Vlastimil Babka wrote:

On 04/30/2014 11:46 PM, Sasha Levin wrote:

On 04/03/2014 11:40 AM, Vlastimil Babka wrote:

For the MIGRATE_RESERVE pages, it is important they do not get misplaced
on free_list of other migratetype, otherwise the whole MIGRATE_RESERVE
pageblock might be changed to other migratetype in try_to_steal_freepages().
For MIGRATE_CMA, the pages also must not go to a different free_list, otherwise
they could get allocated as unmovable and result in CMA failure.

This is ensured by setting the freepage_migratetype appropriately when placing
pages on pcp lists, and using the information when releasing them back to
free_list. It is also assumed that CMA and RESERVE pageblocks are created only
in the init phase. This patch adds DEBUG_VM checks to catch any regressions
introduced for this invariant.

Cc: Yong-Taek Lee ytk@samsung.com
Cc: Bartlomiej Zolnierkiewicz b.zolnier...@samsung.com
Cc: Joonsoo Kim iamjoonsoo@lge.com
Cc: Mel Gorman mgor...@suse.de
Cc: Minchan Kim minc...@kernel.org
Cc: KOSAKI Motohiro kosaki.motoh...@jp.fujitsu.com
Cc: Marek Szyprowski m.szyprow...@samsung.com
Cc: Hugh Dickins hu...@google.com
Cc: Rik van Riel r...@redhat.com
Cc: Michal Nazarewicz min...@mina86.com
Signed-off-by: Vlastimil Babka vba...@suse.cz


Two issues with this patch.

First:

[ 3446.320082] kernel BUG at mm/page_alloc.c:1197!
[ 3446.320082] invalid opcode:  [#1] PREEMPT SMP DEBUG_PAGEALLOC
[ 3446.320082] Dumping ftrace buffer:
[ 3446.320082](ftrace buffer empty)
[ 3446.320082] Modules linked in:
[ 3446.320082] CPU: 1 PID: 8923 Comm: trinity-c42 Not tainted 
3.15.0-rc3-next-20140429-sasha-00015-g7c7e0a7-dirty #427
[ 3446.320082] task: 88053e208000 ti: 88053e246000 task.ti: 
88053e246000
[ 3446.320082] RIP: get_page_from_freelist (mm/page_alloc.c:1197 
mm/page_alloc.c:1548 mm/page_alloc.c:2036)
[ 3446.320082] RSP: 0018:88053e247778  EFLAGS: 00010002
[ 3446.320082] RAX: 0003 RBX: eaf4 RCX: 0008
[ 3446.320082] RDX: 0002 RSI: 0003 RDI: 00a0
[ 3446.320082] RBP: 88053e247868 R08: 0007 R09: 
[ 3446.320082] R10: 88006ffcef00 R11:  R12: 0014
[ 3446.335888] R13: ea000115ffe0 R14: ea000115ffe0 R15: 
[ 3446.335888] FS:  7f8c9f059700() GS:88006ec0() 
knlGS:
[ 3446.335888] CS:  0010 DS:  ES:  CR0: 8005003b
[ 3446.335888] CR2: 02cbc048 CR3: 00054cdb4000 CR4: 06a0
[ 3446.335888] DR0: 006de000 DR1: 006de000 DR2: 
[ 3446.335888] DR3:  DR6: 0ff0 DR7: 0602
[ 3446.335888] Stack:
[ 3446.335888]  88053e247798 88006eddc0b8 0016 

[ 3446.335888]  88006ffd2068 88006ffdb008 0001 

[ 3446.335888]  88006ffdb000  0003 
0001
[ 3446.335888] Call Trace:
[ 3446.335888] __alloc_pages_nodemask (mm/page_alloc.c:2731)
[ 3446.335888] ? __this_cpu_preempt_check (lib/smp_processor_id.c:63)
[ 3446.335888] alloc_pages_vma (include/linux/mempolicy.h:76 
mm/mempolicy.c:1998)
[ 3446.335888] ? shmem_alloc_page (mm/shmem.c:881)
[ 3446.335888] ? kvm_clock_read (arch/x86/include/asm/preempt.h:90 
arch/x86/kernel/kvmclock.c:86)
[ 3446.335888] shmem_alloc_page (mm/shmem.c:881)
[ 3446.335888] ? __const_udelay (arch/x86/lib/delay.c:126)
[ 3446.335888] ? __rcu_read_unlock (kernel/rcu/update.c:97)
[ 3446.335888] ? find_get_entry (mm/filemap.c:979)
[ 3446.335888] ? find_get_entry (mm/filemap.c:940)
[ 3446.335888] ? find_lock_entry (mm/filemap.c:1024)
[ 3446.335888] shmem_getpage_gfp (mm/shmem.c:1130)
[ 3446.335888] ? sched_clock_local (kernel/sched/clock.c:214)
[ 3446.335888] ? do_read_fault.isra.42 (mm/memory.c:3523)
[ 3446.335888] shmem_fault (mm/shmem.c:1237)
[ 3446.335888] ? do_read_fault.isra.42 (mm/memory.c:3523)
[ 3446.335888] __do_fault (mm/memory.c:3344)
[ 3446.335888] ? _raw_spin_unlock (arch/x86/include/asm/preempt.h:98 
include/linux/spinlock_api_smp.h:152 kernel/locking/spinlock.c:183)
[ 3446.335888] do_read_fault.isra.42 (mm/memory.c:3524)
[ 3446.335888] ? get_parent_ip (kernel/sched/core.c:2485)
[ 3446.335888] ? get_parent_ip (kernel/sched/core.c:2485)
[ 3446.335888] __handle_mm_fault (mm/memory.c:3662 mm/memory.c:3823 
mm/memory.c:3950)
[ 3446.335888] ? __const_udelay (arch/x86/lib/delay.c:126)
[ 3446.335888] ? __rcu_read_unlock (kernel/rcu/update.c:97)
[ 3446.335888] handle_mm_fault (mm/memory.c:3973)
[ 3446.335888] __get_user_pages (mm/memory.c:1863)
[ 3446.335888] ? preempt_count_sub 

Re: [PATCH 2/2] mm/page_alloc: DEBUG_VM checks for free_list placement of CMA and RESERVE pages

2014-05-12 Thread Joonsoo Kim
On Mon, May 12, 2014 at 10:28:25AM +0200, Vlastimil Babka wrote:
 On 05/08/2014 07:54 AM, Joonsoo Kim wrote:
 On Wed, May 07, 2014 at 04:59:07PM +0200, Vlastimil Babka wrote:
 On 05/07/2014 03:33 AM, Minchan Kim wrote:
 On Mon, May 05, 2014 at 05:50:46PM +0200, Vlastimil Babka wrote:
 On 05/05/2014 04:36 PM, Sasha Levin wrote:
 On 05/02/2014 08:08 AM, Vlastimil Babka wrote:
 On 04/30/2014 11:46 PM, Sasha Levin wrote:
 On 04/03/2014 11:40 AM, Vlastimil Babka wrote:
 For the MIGRATE_RESERVE pages, it is important they do not get 
 misplaced
 on free_list of other migratetype, otherwise the whole 
 MIGRATE_RESERVE
 pageblock might be changed to other migratetype in 
 try_to_steal_freepages().
 For MIGRATE_CMA, the pages also must not go to a different 
 free_list, otherwise
 they could get allocated as unmovable and result in CMA failure.
 
 This is ensured by setting the freepage_migratetype appropriately 
 when placing
 pages on pcp lists, and using the information when releasing them 
 back to
 free_list. It is also assumed that CMA and RESERVE pageblocks are 
 created only
 in the init phase. This patch adds DEBUG_VM checks to catch any 
 regressions
 introduced for this invariant.
 
 Cc: Yong-Taek Lee ytk@samsung.com
 Cc: Bartlomiej Zolnierkiewicz b.zolnier...@samsung.com
 Cc: Joonsoo Kim iamjoonsoo@lge.com
 Cc: Mel Gorman mgor...@suse.de
 Cc: Minchan Kim minc...@kernel.org
 Cc: KOSAKI Motohiro kosaki.motoh...@jp.fujitsu.com
 Cc: Marek Szyprowski m.szyprow...@samsung.com
 Cc: Hugh Dickins hu...@google.com
 Cc: Rik van Riel r...@redhat.com
 Cc: Michal Nazarewicz min...@mina86.com
 Signed-off-by: Vlastimil Babka vba...@suse.cz
 
 Two issues with this patch.
 
 First:
 
 [ 3446.320082] kernel BUG at mm/page_alloc.c:1197!
 [ 3446.320082] invalid opcode:  [#1] PREEMPT SMP DEBUG_PAGEALLOC
 [ 3446.320082] Dumping ftrace buffer:
 [ 3446.320082](ftrace buffer empty)
 [ 3446.320082] Modules linked in:
 [ 3446.320082] CPU: 1 PID: 8923 Comm: trinity-c42 Not tainted 
 3.15.0-rc3-next-20140429-sasha-00015-g7c7e0a7-dirty #427
 [ 3446.320082] task: 88053e208000 ti: 88053e246000 task.ti: 
 88053e246000
 [ 3446.320082] RIP: get_page_from_freelist (mm/page_alloc.c:1197 
 mm/page_alloc.c:1548 mm/page_alloc.c:2036)
 [ 3446.320082] RSP: 0018:88053e247778  EFLAGS: 00010002
 [ 3446.320082] RAX: 0003 RBX: eaf4 RCX: 
 0008
 [ 3446.320082] RDX: 0002 RSI: 0003 RDI: 
 00a0
 [ 3446.320082] RBP: 88053e247868 R08: 0007 R09: 
 
 [ 3446.320082] R10: 88006ffcef00 R11:  R12: 
 0014
 [ 3446.335888] R13: ea000115ffe0 R14: ea000115ffe0 R15: 
 
 [ 3446.335888] FS:  7f8c9f059700() GS:88006ec0() 
 knlGS:
 [ 3446.335888] CS:  0010 DS:  ES:  CR0: 8005003b
 [ 3446.335888] CR2: 02cbc048 CR3: 00054cdb4000 CR4: 
 06a0
 [ 3446.335888] DR0: 006de000 DR1: 006de000 DR2: 
 
 [ 3446.335888] DR3:  DR6: 0ff0 DR7: 
 0602
 [ 3446.335888] Stack:
 [ 3446.335888]  88053e247798 88006eddc0b8 0016 
 
 [ 3446.335888]  88006ffd2068 88006ffdb008 0001 
 
 [ 3446.335888]  88006ffdb000  0003 
 0001
 [ 3446.335888] Call Trace:
 [ 3446.335888] __alloc_pages_nodemask (mm/page_alloc.c:2731)
 [ 3446.335888] ? __this_cpu_preempt_check (lib/smp_processor_id.c:63)
 [ 3446.335888] alloc_pages_vma (include/linux/mempolicy.h:76 
 mm/mempolicy.c:1998)
 [ 3446.335888] ? shmem_alloc_page (mm/shmem.c:881)
 [ 3446.335888] ? kvm_clock_read (arch/x86/include/asm/preempt.h:90 
 arch/x86/kernel/kvmclock.c:86)
 [ 3446.335888] shmem_alloc_page (mm/shmem.c:881)
 [ 3446.335888] ? __const_udelay (arch/x86/lib/delay.c:126)
 [ 3446.335888] ? __rcu_read_unlock (kernel/rcu/update.c:97)
 [ 3446.335888] ? find_get_entry (mm/filemap.c:979)
 [ 3446.335888] ? find_get_entry (mm/filemap.c:940)
 [ 3446.335888] ? find_lock_entry (mm/filemap.c:1024)
 [ 3446.335888] shmem_getpage_gfp (mm/shmem.c:1130)
 [ 3446.335888] ? sched_clock_local (kernel/sched/clock.c:214)
 [ 3446.335888] ? do_read_fault.isra.42 (mm/memory.c:3523)
 [ 3446.335888] shmem_fault (mm/shmem.c:1237)
 [ 3446.335888] ? do_read_fault.isra.42 (mm/memory.c:3523)
 [ 3446.335888] __do_fault (mm/memory.c:3344)
 [ 3446.335888] ? _raw_spin_unlock (arch/x86/include/asm/preempt.h:98 
 include/linux/spinlock_api_smp.h:152 kernel/locking/spinlock.c:183)
 [ 3446.335888] do_read_fault.isra.42 (mm/memory.c:3524)
 [ 3446.335888] ? get_parent_ip (kernel/sched/core.c:2485)
 [ 3446.335888] ? get_parent_ip (kernel/sched/core.c:2485)
 [ 3446.335888] __handle_mm_fault (mm/memory.c:3662 mm/memory.c:3823 
 mm/memory.c:3950)
 [ 3446.335888] ? __const_udelay (arch/x86/lib/delay.c:126)
 [ 3446.335888] ? __rcu_read_unlock 

Re: [PATCH 2/2] mm/page_alloc: DEBUG_VM checks for free_list placement of CMA and RESERVE pages

2014-05-12 Thread Joonsoo Kim
On Thu, May 08, 2014 at 03:34:33PM -0700, Andrew Morton wrote:
 On Thu, 8 May 2014 15:19:37 +0900 Minchan Kim minc...@kernel.org wrote:
 
   I also think that VM_DEBUG overhead isn't problem because of same
   reason from Vlastimil.
  
  Guys, please read this.
  
  https://lkml.org/lkml/2013/7/17/591
  
  If you guys really want it, we could separate it with
  CONFIG_DEBUG_CMA or CONFIG_DEBUG_RESERVE like stuff.
  Otherwise, just remain in mmotm.
 
 Wise words, those.
 
 Yes, these checks are in a pretty hot path.  I'm inclined to make the
 patch -mm (and -next) only.
 
 Unless there's a really good reason, such as nobody who uses CMA is
 likely to be testing -next, which sounds likely :(

Hello,

Now, I think that dropping this patch is better if we can only use it
on MIGRATE_CMA case. Later, if I feel that this case should be checked,
I will resend the patch with appropriate argument.

Thanks.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/2] mm/page_alloc: DEBUG_VM checks for free_list placement of CMA and RESERVE pages

2014-05-08 Thread Andrew Morton
On Thu, 8 May 2014 15:19:37 +0900 Minchan Kim  wrote:

> > I also think that VM_DEBUG overhead isn't problem because of same
> > reason from Vlastimil.
> 
> Guys, please read this.
> 
> https://lkml.org/lkml/2013/7/17/591
> 
> If you guys really want it, we could separate it with
> CONFIG_DEBUG_CMA or CONFIG_DEBUG_RESERVE like stuff.
> Otherwise, just remain in mmotm.

Wise words, those.

Yes, these checks are in a pretty hot path.  I'm inclined to make the
patch -mm (and -next) only.

Unless there's a really good reason, such as "nobody who uses CMA is
likely to be testing -next", which sounds likely :(

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/2] mm/page_alloc: DEBUG_VM checks for free_list placement of CMA and RESERVE pages

2014-05-08 Thread Mel Gorman
On Thu, May 08, 2014 at 02:54:21PM +0900, Joonsoo Kim wrote:
> > >> Furthermore, I think there's a problem that
> > >> setup_zone_migrate_reserve() operates on pageblocks, but as MAX_ODER
> > >> is higher than pageblock_order, RESERVE pages might be merged with
> > >> buddies of different migratetype and end up on their free_list. That
> > >> seems to me like a flaw in the design of reserves, but perhaps
> > >> others won't think it's serious enough to fix?
> 
> I wanna know who want MIGRATE_RESERVE. On my previous testing, one
> pageblock for MIGRATE_RESERVE is merged with buddies of different
> migratetype during boot-up and never come back again. But my system works
> well. :)
> 

It's important for short-lived high-order atomic allocations.
MIGRATE_RESERVE preserves a property of the buddy allocator prior to the
merging of fragmentation avoidance. Most users will not notice as not
many drivers depend on these allocations working. If they are getting
destroyed at boot-up, it's a bug.

-- 
Mel Gorman
SUSE Labs
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/2] mm/page_alloc: DEBUG_VM checks for free_list placement of CMA and RESERVE pages

2014-05-08 Thread Minchan Kim
On Thu, May 08, 2014 at 02:54:21PM +0900, Joonsoo Kim wrote:
> On Wed, May 07, 2014 at 04:59:07PM +0200, Vlastimil Babka wrote:
> > On 05/07/2014 03:33 AM, Minchan Kim wrote:
> > > On Mon, May 05, 2014 at 05:50:46PM +0200, Vlastimil Babka wrote:
> > >> On 05/05/2014 04:36 PM, Sasha Levin wrote:
> > >>> On 05/02/2014 08:08 AM, Vlastimil Babka wrote:
> >  On 04/30/2014 11:46 PM, Sasha Levin wrote:
> > >> On 04/03/2014 11:40 AM, Vlastimil Babka wrote:
> >  For the MIGRATE_RESERVE pages, it is important they do not get 
> >  misplaced
> >  on free_list of other migratetype, otherwise the whole 
> >  MIGRATE_RESERVE
> >  pageblock might be changed to other migratetype in 
> >  try_to_steal_freepages().
> >  For MIGRATE_CMA, the pages also must not go to a different 
> >  free_list, otherwise
> >  they could get allocated as unmovable and result in CMA failure.
> > 
> >  This is ensured by setting the freepage_migratetype appropriately 
> >  when placing
> >  pages on pcp lists, and using the information when releasing them 
> >  back to
> >  free_list. It is also assumed that CMA and RESERVE pageblocks are 
> >  created only
> >  in the init phase. This patch adds DEBUG_VM checks to catch any 
> >  regressions
> >  introduced for this invariant.
> > 
> >  Cc: Yong-Taek Lee 
> >  Cc: Bartlomiej Zolnierkiewicz 
> >  Cc: Joonsoo Kim 
> >  Cc: Mel Gorman 
> >  Cc: Minchan Kim 
> >  Cc: KOSAKI Motohiro 
> >  Cc: Marek Szyprowski 
> >  Cc: Hugh Dickins 
> >  Cc: Rik van Riel 
> >  Cc: Michal Nazarewicz 
> >  Signed-off-by: Vlastimil Babka 
> > >>
> > >> Two issues with this patch.
> > >>
> > >> First:
> > >>
> > >> [ 3446.320082] kernel BUG at mm/page_alloc.c:1197!
> > >> [ 3446.320082] invalid opcode:  [#1] PREEMPT SMP DEBUG_PAGEALLOC
> > >> [ 3446.320082] Dumping ftrace buffer:
> > >> [ 3446.320082](ftrace buffer empty)
> > >> [ 3446.320082] Modules linked in:
> > >> [ 3446.320082] CPU: 1 PID: 8923 Comm: trinity-c42 Not tainted 
> > >> 3.15.0-rc3-next-20140429-sasha-00015-g7c7e0a7-dirty #427
> > >> [ 3446.320082] task: 88053e208000 ti: 88053e246000 task.ti: 
> > >> 88053e246000
> > >> [ 3446.320082] RIP: get_page_from_freelist (mm/page_alloc.c:1197 
> > >> mm/page_alloc.c:1548 mm/page_alloc.c:2036)
> > >> [ 3446.320082] RSP: 0018:88053e247778  EFLAGS: 00010002
> > >> [ 3446.320082] RAX: 0003 RBX: eaf4 RCX: 
> > >> 0008
> > >> [ 3446.320082] RDX: 0002 RSI: 0003 RDI: 
> > >> 00a0
> > >> [ 3446.320082] RBP: 88053e247868 R08: 0007 R09: 
> > >> 
> > >> [ 3446.320082] R10: 88006ffcef00 R11:  R12: 
> > >> 0014
> > >> [ 3446.335888] R13: ea000115ffe0 R14: ea000115ffe0 R15: 
> > >> 
> > >> [ 3446.335888] FS:  7f8c9f059700() GS:88006ec0() 
> > >> knlGS:
> > >> [ 3446.335888] CS:  0010 DS:  ES:  CR0: 8005003b
> > >> [ 3446.335888] CR2: 02cbc048 CR3: 00054cdb4000 CR4: 
> > >> 06a0
> > >> [ 3446.335888] DR0: 006de000 DR1: 006de000 DR2: 
> > >> 
> > >> [ 3446.335888] DR3:  DR6: 0ff0 DR7: 
> > >> 0602
> > >> [ 3446.335888] Stack:
> > >> [ 3446.335888]  88053e247798 88006eddc0b8 0016 
> > >> 
> > >> [ 3446.335888]  88006ffd2068 88006ffdb008 0001 
> > >> 
> > >> [ 3446.335888]  88006ffdb000  0003 
> > >> 0001
> > >> [ 3446.335888] Call Trace:
> > >> [ 3446.335888] __alloc_pages_nodemask (mm/page_alloc.c:2731)
> > >> [ 3446.335888] ? __this_cpu_preempt_check (lib/smp_processor_id.c:63)
> > >> [ 3446.335888] alloc_pages_vma (include/linux/mempolicy.h:76 
> > >> mm/mempolicy.c:1998)
> > >> [ 3446.335888] ? shmem_alloc_page (mm/shmem.c:881)
> > >> [ 3446.335888] ? kvm_clock_read (arch/x86/include/asm/preempt.h:90 
> > >> arch/x86/kernel/kvmclock.c:86)
> > >> [ 3446.335888] shmem_alloc_page (mm/shmem.c:881)
> > >> [ 3446.335888] ? __const_udelay (arch/x86/lib/delay.c:126)
> > >> [ 3446.335888] ? __rcu_read_unlock (kernel/rcu/update.c:97)
> > >> [ 3446.335888] ? find_get_entry (mm/filemap.c:979)
> > >> [ 3446.335888] ? find_get_entry (mm/filemap.c:940)
> > >> [ 3446.335888] ? find_lock_entry (mm/filemap.c:1024)
> > >> [ 3446.335888] shmem_getpage_gfp (mm/shmem.c:1130)
> > >> [ 3446.335888] ? sched_clock_local 

Re: [PATCH 2/2] mm/page_alloc: DEBUG_VM checks for free_list placement of CMA and RESERVE pages

2014-05-08 Thread Minchan Kim
On Thu, May 08, 2014 at 02:54:21PM +0900, Joonsoo Kim wrote:
 On Wed, May 07, 2014 at 04:59:07PM +0200, Vlastimil Babka wrote:
  On 05/07/2014 03:33 AM, Minchan Kim wrote:
   On Mon, May 05, 2014 at 05:50:46PM +0200, Vlastimil Babka wrote:
   On 05/05/2014 04:36 PM, Sasha Levin wrote:
   On 05/02/2014 08:08 AM, Vlastimil Babka wrote:
   On 04/30/2014 11:46 PM, Sasha Levin wrote:
   On 04/03/2014 11:40 AM, Vlastimil Babka wrote:
   For the MIGRATE_RESERVE pages, it is important they do not get 
   misplaced
   on free_list of other migratetype, otherwise the whole 
   MIGRATE_RESERVE
   pageblock might be changed to other migratetype in 
   try_to_steal_freepages().
   For MIGRATE_CMA, the pages also must not go to a different 
   free_list, otherwise
   they could get allocated as unmovable and result in CMA failure.
  
   This is ensured by setting the freepage_migratetype appropriately 
   when placing
   pages on pcp lists, and using the information when releasing them 
   back to
   free_list. It is also assumed that CMA and RESERVE pageblocks are 
   created only
   in the init phase. This patch adds DEBUG_VM checks to catch any 
   regressions
   introduced for this invariant.
  
   Cc: Yong-Taek Lee ytk@samsung.com
   Cc: Bartlomiej Zolnierkiewicz b.zolnier...@samsung.com
   Cc: Joonsoo Kim iamjoonsoo@lge.com
   Cc: Mel Gorman mgor...@suse.de
   Cc: Minchan Kim minc...@kernel.org
   Cc: KOSAKI Motohiro kosaki.motoh...@jp.fujitsu.com
   Cc: Marek Szyprowski m.szyprow...@samsung.com
   Cc: Hugh Dickins hu...@google.com
   Cc: Rik van Riel r...@redhat.com
   Cc: Michal Nazarewicz min...@mina86.com
   Signed-off-by: Vlastimil Babka vba...@suse.cz
  
   Two issues with this patch.
  
   First:
  
   [ 3446.320082] kernel BUG at mm/page_alloc.c:1197!
   [ 3446.320082] invalid opcode:  [#1] PREEMPT SMP DEBUG_PAGEALLOC
   [ 3446.320082] Dumping ftrace buffer:
   [ 3446.320082](ftrace buffer empty)
   [ 3446.320082] Modules linked in:
   [ 3446.320082] CPU: 1 PID: 8923 Comm: trinity-c42 Not tainted 
   3.15.0-rc3-next-20140429-sasha-00015-g7c7e0a7-dirty #427
   [ 3446.320082] task: 88053e208000 ti: 88053e246000 task.ti: 
   88053e246000
   [ 3446.320082] RIP: get_page_from_freelist (mm/page_alloc.c:1197 
   mm/page_alloc.c:1548 mm/page_alloc.c:2036)
   [ 3446.320082] RSP: 0018:88053e247778  EFLAGS: 00010002
   [ 3446.320082] RAX: 0003 RBX: eaf4 RCX: 
   0008
   [ 3446.320082] RDX: 0002 RSI: 0003 RDI: 
   00a0
   [ 3446.320082] RBP: 88053e247868 R08: 0007 R09: 
   
   [ 3446.320082] R10: 88006ffcef00 R11:  R12: 
   0014
   [ 3446.335888] R13: ea000115ffe0 R14: ea000115ffe0 R15: 
   
   [ 3446.335888] FS:  7f8c9f059700() GS:88006ec0() 
   knlGS:
   [ 3446.335888] CS:  0010 DS:  ES:  CR0: 8005003b
   [ 3446.335888] CR2: 02cbc048 CR3: 00054cdb4000 CR4: 
   06a0
   [ 3446.335888] DR0: 006de000 DR1: 006de000 DR2: 
   
   [ 3446.335888] DR3:  DR6: 0ff0 DR7: 
   0602
   [ 3446.335888] Stack:
   [ 3446.335888]  88053e247798 88006eddc0b8 0016 
   
   [ 3446.335888]  88006ffd2068 88006ffdb008 0001 
   
   [ 3446.335888]  88006ffdb000  0003 
   0001
   [ 3446.335888] Call Trace:
   [ 3446.335888] __alloc_pages_nodemask (mm/page_alloc.c:2731)
   [ 3446.335888] ? __this_cpu_preempt_check (lib/smp_processor_id.c:63)
   [ 3446.335888] alloc_pages_vma (include/linux/mempolicy.h:76 
   mm/mempolicy.c:1998)
   [ 3446.335888] ? shmem_alloc_page (mm/shmem.c:881)
   [ 3446.335888] ? kvm_clock_read (arch/x86/include/asm/preempt.h:90 
   arch/x86/kernel/kvmclock.c:86)
   [ 3446.335888] shmem_alloc_page (mm/shmem.c:881)
   [ 3446.335888] ? __const_udelay (arch/x86/lib/delay.c:126)
   [ 3446.335888] ? __rcu_read_unlock (kernel/rcu/update.c:97)
   [ 3446.335888] ? find_get_entry (mm/filemap.c:979)
   [ 3446.335888] ? find_get_entry (mm/filemap.c:940)
   [ 3446.335888] ? find_lock_entry (mm/filemap.c:1024)
   [ 3446.335888] shmem_getpage_gfp (mm/shmem.c:1130)
   [ 3446.335888] ? sched_clock_local (kernel/sched/clock.c:214)
   [ 3446.335888] ? do_read_fault.isra.42 (mm/memory.c:3523)
   [ 3446.335888] shmem_fault (mm/shmem.c:1237)
   [ 3446.335888] ? do_read_fault.isra.42 (mm/memory.c:3523)
   [ 3446.335888] __do_fault (mm/memory.c:3344)
   [ 3446.335888] ? _raw_spin_unlock (arch/x86/include/asm/preempt.h:98 
   include/linux/spinlock_api_smp.h:152 kernel/locking/spinlock.c:183)
   [ 3446.335888] do_read_fault.isra.42 (mm/memory.c:3524)
   [ 3446.335888] ? get_parent_ip (kernel/sched/core.c:2485)
   [ 3446.335888] ? get_parent_ip (kernel/sched/core.c:2485)
   [ 3446.335888] 

Re: [PATCH 2/2] mm/page_alloc: DEBUG_VM checks for free_list placement of CMA and RESERVE pages

2014-05-08 Thread Mel Gorman
On Thu, May 08, 2014 at 02:54:21PM +0900, Joonsoo Kim wrote:
   Furthermore, I think there's a problem that
   setup_zone_migrate_reserve() operates on pageblocks, but as MAX_ODER
   is higher than pageblock_order, RESERVE pages might be merged with
   buddies of different migratetype and end up on their free_list. That
   seems to me like a flaw in the design of reserves, but perhaps
   others won't think it's serious enough to fix?
 
 I wanna know who want MIGRATE_RESERVE. On my previous testing, one
 pageblock for MIGRATE_RESERVE is merged with buddies of different
 migratetype during boot-up and never come back again. But my system works
 well. :)
 

It's important for short-lived high-order atomic allocations.
MIGRATE_RESERVE preserves a property of the buddy allocator prior to the
merging of fragmentation avoidance. Most users will not notice as not
many drivers depend on these allocations working. If they are getting
destroyed at boot-up, it's a bug.

-- 
Mel Gorman
SUSE Labs
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/2] mm/page_alloc: DEBUG_VM checks for free_list placement of CMA and RESERVE pages

2014-05-08 Thread Andrew Morton
On Thu, 8 May 2014 15:19:37 +0900 Minchan Kim minc...@kernel.org wrote:

  I also think that VM_DEBUG overhead isn't problem because of same
  reason from Vlastimil.
 
 Guys, please read this.
 
 https://lkml.org/lkml/2013/7/17/591
 
 If you guys really want it, we could separate it with
 CONFIG_DEBUG_CMA or CONFIG_DEBUG_RESERVE like stuff.
 Otherwise, just remain in mmotm.

Wise words, those.

Yes, these checks are in a pretty hot path.  I'm inclined to make the
patch -mm (and -next) only.

Unless there's a really good reason, such as nobody who uses CMA is
likely to be testing -next, which sounds likely :(

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/2] mm/page_alloc: DEBUG_VM checks for free_list placement of CMA and RESERVE pages

2014-05-07 Thread Joonsoo Kim
On Wed, May 07, 2014 at 04:59:07PM +0200, Vlastimil Babka wrote:
> On 05/07/2014 03:33 AM, Minchan Kim wrote:
> > On Mon, May 05, 2014 at 05:50:46PM +0200, Vlastimil Babka wrote:
> >> On 05/05/2014 04:36 PM, Sasha Levin wrote:
> >>> On 05/02/2014 08:08 AM, Vlastimil Babka wrote:
>  On 04/30/2014 11:46 PM, Sasha Levin wrote:
> >> On 04/03/2014 11:40 AM, Vlastimil Babka wrote:
>  For the MIGRATE_RESERVE pages, it is important they do not get 
>  misplaced
>  on free_list of other migratetype, otherwise the whole 
>  MIGRATE_RESERVE
>  pageblock might be changed to other migratetype in 
>  try_to_steal_freepages().
>  For MIGRATE_CMA, the pages also must not go to a different 
>  free_list, otherwise
>  they could get allocated as unmovable and result in CMA failure.
> 
>  This is ensured by setting the freepage_migratetype appropriately 
>  when placing
>  pages on pcp lists, and using the information when releasing them 
>  back to
>  free_list. It is also assumed that CMA and RESERVE pageblocks are 
>  created only
>  in the init phase. This patch adds DEBUG_VM checks to catch any 
>  regressions
>  introduced for this invariant.
> 
>  Cc: Yong-Taek Lee 
>  Cc: Bartlomiej Zolnierkiewicz 
>  Cc: Joonsoo Kim 
>  Cc: Mel Gorman 
>  Cc: Minchan Kim 
>  Cc: KOSAKI Motohiro 
>  Cc: Marek Szyprowski 
>  Cc: Hugh Dickins 
>  Cc: Rik van Riel 
>  Cc: Michal Nazarewicz 
>  Signed-off-by: Vlastimil Babka 
> >>
> >> Two issues with this patch.
> >>
> >> First:
> >>
> >> [ 3446.320082] kernel BUG at mm/page_alloc.c:1197!
> >> [ 3446.320082] invalid opcode:  [#1] PREEMPT SMP DEBUG_PAGEALLOC
> >> [ 3446.320082] Dumping ftrace buffer:
> >> [ 3446.320082](ftrace buffer empty)
> >> [ 3446.320082] Modules linked in:
> >> [ 3446.320082] CPU: 1 PID: 8923 Comm: trinity-c42 Not tainted 
> >> 3.15.0-rc3-next-20140429-sasha-00015-g7c7e0a7-dirty #427
> >> [ 3446.320082] task: 88053e208000 ti: 88053e246000 task.ti: 
> >> 88053e246000
> >> [ 3446.320082] RIP: get_page_from_freelist (mm/page_alloc.c:1197 
> >> mm/page_alloc.c:1548 mm/page_alloc.c:2036)
> >> [ 3446.320082] RSP: 0018:88053e247778  EFLAGS: 00010002
> >> [ 3446.320082] RAX: 0003 RBX: eaf4 RCX: 
> >> 0008
> >> [ 3446.320082] RDX: 0002 RSI: 0003 RDI: 
> >> 00a0
> >> [ 3446.320082] RBP: 88053e247868 R08: 0007 R09: 
> >> 
> >> [ 3446.320082] R10: 88006ffcef00 R11:  R12: 
> >> 0014
> >> [ 3446.335888] R13: ea000115ffe0 R14: ea000115ffe0 R15: 
> >> 
> >> [ 3446.335888] FS:  7f8c9f059700() GS:88006ec0() 
> >> knlGS:
> >> [ 3446.335888] CS:  0010 DS:  ES:  CR0: 8005003b
> >> [ 3446.335888] CR2: 02cbc048 CR3: 00054cdb4000 CR4: 
> >> 06a0
> >> [ 3446.335888] DR0: 006de000 DR1: 006de000 DR2: 
> >> 
> >> [ 3446.335888] DR3:  DR6: 0ff0 DR7: 
> >> 0602
> >> [ 3446.335888] Stack:
> >> [ 3446.335888]  88053e247798 88006eddc0b8 0016 
> >> 
> >> [ 3446.335888]  88006ffd2068 88006ffdb008 0001 
> >> 
> >> [ 3446.335888]  88006ffdb000  0003 
> >> 0001
> >> [ 3446.335888] Call Trace:
> >> [ 3446.335888] __alloc_pages_nodemask (mm/page_alloc.c:2731)
> >> [ 3446.335888] ? __this_cpu_preempt_check (lib/smp_processor_id.c:63)
> >> [ 3446.335888] alloc_pages_vma (include/linux/mempolicy.h:76 
> >> mm/mempolicy.c:1998)
> >> [ 3446.335888] ? shmem_alloc_page (mm/shmem.c:881)
> >> [ 3446.335888] ? kvm_clock_read (arch/x86/include/asm/preempt.h:90 
> >> arch/x86/kernel/kvmclock.c:86)
> >> [ 3446.335888] shmem_alloc_page (mm/shmem.c:881)
> >> [ 3446.335888] ? __const_udelay (arch/x86/lib/delay.c:126)
> >> [ 3446.335888] ? __rcu_read_unlock (kernel/rcu/update.c:97)
> >> [ 3446.335888] ? find_get_entry (mm/filemap.c:979)
> >> [ 3446.335888] ? find_get_entry (mm/filemap.c:940)
> >> [ 3446.335888] ? find_lock_entry (mm/filemap.c:1024)
> >> [ 3446.335888] shmem_getpage_gfp (mm/shmem.c:1130)
> >> [ 3446.335888] ? sched_clock_local (kernel/sched/clock.c:214)
> >> [ 3446.335888] ? do_read_fault.isra.42 (mm/memory.c:3523)
> >> [ 3446.335888] shmem_fault (mm/shmem.c:1237)
> >> [ 3446.335888] ? do_read_fault.isra.42 (mm/memory.c:3523)
> >> [ 3446.335888] __do_fault 

Re: [PATCH 2/2] mm/page_alloc: DEBUG_VM checks for free_list placement of CMA and RESERVE pages

2014-05-07 Thread Vlastimil Babka
On 05/07/2014 03:33 AM, Minchan Kim wrote:
> On Mon, May 05, 2014 at 05:50:46PM +0200, Vlastimil Babka wrote:
>> On 05/05/2014 04:36 PM, Sasha Levin wrote:
>>> On 05/02/2014 08:08 AM, Vlastimil Babka wrote:
 On 04/30/2014 11:46 PM, Sasha Levin wrote:
>> On 04/03/2014 11:40 AM, Vlastimil Babka wrote:
 For the MIGRATE_RESERVE pages, it is important they do not get 
 misplaced
 on free_list of other migratetype, otherwise the whole MIGRATE_RESERVE
 pageblock might be changed to other migratetype in 
 try_to_steal_freepages().
 For MIGRATE_CMA, the pages also must not go to a different free_list, 
 otherwise
 they could get allocated as unmovable and result in CMA failure.

 This is ensured by setting the freepage_migratetype appropriately when 
 placing
 pages on pcp lists, and using the information when releasing them back 
 to
 free_list. It is also assumed that CMA and RESERVE pageblocks are 
 created only
 in the init phase. This patch adds DEBUG_VM checks to catch any 
 regressions
 introduced for this invariant.

 Cc: Yong-Taek Lee 
 Cc: Bartlomiej Zolnierkiewicz 
 Cc: Joonsoo Kim 
 Cc: Mel Gorman 
 Cc: Minchan Kim 
 Cc: KOSAKI Motohiro 
 Cc: Marek Szyprowski 
 Cc: Hugh Dickins 
 Cc: Rik van Riel 
 Cc: Michal Nazarewicz 
 Signed-off-by: Vlastimil Babka 
>>
>> Two issues with this patch.
>>
>> First:
>>
>> [ 3446.320082] kernel BUG at mm/page_alloc.c:1197!
>> [ 3446.320082] invalid opcode:  [#1] PREEMPT SMP DEBUG_PAGEALLOC
>> [ 3446.320082] Dumping ftrace buffer:
>> [ 3446.320082](ftrace buffer empty)
>> [ 3446.320082] Modules linked in:
>> [ 3446.320082] CPU: 1 PID: 8923 Comm: trinity-c42 Not tainted 
>> 3.15.0-rc3-next-20140429-sasha-00015-g7c7e0a7-dirty #427
>> [ 3446.320082] task: 88053e208000 ti: 88053e246000 task.ti: 
>> 88053e246000
>> [ 3446.320082] RIP: get_page_from_freelist (mm/page_alloc.c:1197 
>> mm/page_alloc.c:1548 mm/page_alloc.c:2036)
>> [ 3446.320082] RSP: 0018:88053e247778  EFLAGS: 00010002
>> [ 3446.320082] RAX: 0003 RBX: eaf4 RCX: 
>> 0008
>> [ 3446.320082] RDX: 0002 RSI: 0003 RDI: 
>> 00a0
>> [ 3446.320082] RBP: 88053e247868 R08: 0007 R09: 
>> 
>> [ 3446.320082] R10: 88006ffcef00 R11:  R12: 
>> 0014
>> [ 3446.335888] R13: ea000115ffe0 R14: ea000115ffe0 R15: 
>> 
>> [ 3446.335888] FS:  7f8c9f059700() GS:88006ec0() 
>> knlGS:
>> [ 3446.335888] CS:  0010 DS:  ES:  CR0: 8005003b
>> [ 3446.335888] CR2: 02cbc048 CR3: 00054cdb4000 CR4: 
>> 06a0
>> [ 3446.335888] DR0: 006de000 DR1: 006de000 DR2: 
>> 
>> [ 3446.335888] DR3:  DR6: 0ff0 DR7: 
>> 0602
>> [ 3446.335888] Stack:
>> [ 3446.335888]  88053e247798 88006eddc0b8 0016 
>> 
>> [ 3446.335888]  88006ffd2068 88006ffdb008 0001 
>> 
>> [ 3446.335888]  88006ffdb000  0003 
>> 0001
>> [ 3446.335888] Call Trace:
>> [ 3446.335888] __alloc_pages_nodemask (mm/page_alloc.c:2731)
>> [ 3446.335888] ? __this_cpu_preempt_check (lib/smp_processor_id.c:63)
>> [ 3446.335888] alloc_pages_vma (include/linux/mempolicy.h:76 
>> mm/mempolicy.c:1998)
>> [ 3446.335888] ? shmem_alloc_page (mm/shmem.c:881)
>> [ 3446.335888] ? kvm_clock_read (arch/x86/include/asm/preempt.h:90 
>> arch/x86/kernel/kvmclock.c:86)
>> [ 3446.335888] shmem_alloc_page (mm/shmem.c:881)
>> [ 3446.335888] ? __const_udelay (arch/x86/lib/delay.c:126)
>> [ 3446.335888] ? __rcu_read_unlock (kernel/rcu/update.c:97)
>> [ 3446.335888] ? find_get_entry (mm/filemap.c:979)
>> [ 3446.335888] ? find_get_entry (mm/filemap.c:940)
>> [ 3446.335888] ? find_lock_entry (mm/filemap.c:1024)
>> [ 3446.335888] shmem_getpage_gfp (mm/shmem.c:1130)
>> [ 3446.335888] ? sched_clock_local (kernel/sched/clock.c:214)
>> [ 3446.335888] ? do_read_fault.isra.42 (mm/memory.c:3523)
>> [ 3446.335888] shmem_fault (mm/shmem.c:1237)
>> [ 3446.335888] ? do_read_fault.isra.42 (mm/memory.c:3523)
>> [ 3446.335888] __do_fault (mm/memory.c:3344)
>> [ 3446.335888] ? _raw_spin_unlock (arch/x86/include/asm/preempt.h:98 
>> include/linux/spinlock_api_smp.h:152 kernel/locking/spinlock.c:183)
>> [ 3446.335888] do_read_fault.isra.42 (mm/memory.c:3524)
>> [ 3446.335888] ? get_parent_ip 

Re: [PATCH 2/2] mm/page_alloc: DEBUG_VM checks for free_list placement of CMA and RESERVE pages

2014-05-07 Thread Vlastimil Babka
On 05/07/2014 03:33 AM, Minchan Kim wrote:
 On Mon, May 05, 2014 at 05:50:46PM +0200, Vlastimil Babka wrote:
 On 05/05/2014 04:36 PM, Sasha Levin wrote:
 On 05/02/2014 08:08 AM, Vlastimil Babka wrote:
 On 04/30/2014 11:46 PM, Sasha Levin wrote:
 On 04/03/2014 11:40 AM, Vlastimil Babka wrote:
 For the MIGRATE_RESERVE pages, it is important they do not get 
 misplaced
 on free_list of other migratetype, otherwise the whole MIGRATE_RESERVE
 pageblock might be changed to other migratetype in 
 try_to_steal_freepages().
 For MIGRATE_CMA, the pages also must not go to a different free_list, 
 otherwise
 they could get allocated as unmovable and result in CMA failure.

 This is ensured by setting the freepage_migratetype appropriately when 
 placing
 pages on pcp lists, and using the information when releasing them back 
 to
 free_list. It is also assumed that CMA and RESERVE pageblocks are 
 created only
 in the init phase. This patch adds DEBUG_VM checks to catch any 
 regressions
 introduced for this invariant.

 Cc: Yong-Taek Lee ytk@samsung.com
 Cc: Bartlomiej Zolnierkiewicz b.zolnier...@samsung.com
 Cc: Joonsoo Kim iamjoonsoo@lge.com
 Cc: Mel Gorman mgor...@suse.de
 Cc: Minchan Kim minc...@kernel.org
 Cc: KOSAKI Motohiro kosaki.motoh...@jp.fujitsu.com
 Cc: Marek Szyprowski m.szyprow...@samsung.com
 Cc: Hugh Dickins hu...@google.com
 Cc: Rik van Riel r...@redhat.com
 Cc: Michal Nazarewicz min...@mina86.com
 Signed-off-by: Vlastimil Babka vba...@suse.cz

 Two issues with this patch.

 First:

 [ 3446.320082] kernel BUG at mm/page_alloc.c:1197!
 [ 3446.320082] invalid opcode:  [#1] PREEMPT SMP DEBUG_PAGEALLOC
 [ 3446.320082] Dumping ftrace buffer:
 [ 3446.320082](ftrace buffer empty)
 [ 3446.320082] Modules linked in:
 [ 3446.320082] CPU: 1 PID: 8923 Comm: trinity-c42 Not tainted 
 3.15.0-rc3-next-20140429-sasha-00015-g7c7e0a7-dirty #427
 [ 3446.320082] task: 88053e208000 ti: 88053e246000 task.ti: 
 88053e246000
 [ 3446.320082] RIP: get_page_from_freelist (mm/page_alloc.c:1197 
 mm/page_alloc.c:1548 mm/page_alloc.c:2036)
 [ 3446.320082] RSP: 0018:88053e247778  EFLAGS: 00010002
 [ 3446.320082] RAX: 0003 RBX: eaf4 RCX: 
 0008
 [ 3446.320082] RDX: 0002 RSI: 0003 RDI: 
 00a0
 [ 3446.320082] RBP: 88053e247868 R08: 0007 R09: 
 
 [ 3446.320082] R10: 88006ffcef00 R11:  R12: 
 0014
 [ 3446.335888] R13: ea000115ffe0 R14: ea000115ffe0 R15: 
 
 [ 3446.335888] FS:  7f8c9f059700() GS:88006ec0() 
 knlGS:
 [ 3446.335888] CS:  0010 DS:  ES:  CR0: 8005003b
 [ 3446.335888] CR2: 02cbc048 CR3: 00054cdb4000 CR4: 
 06a0
 [ 3446.335888] DR0: 006de000 DR1: 006de000 DR2: 
 
 [ 3446.335888] DR3:  DR6: 0ff0 DR7: 
 0602
 [ 3446.335888] Stack:
 [ 3446.335888]  88053e247798 88006eddc0b8 0016 
 
 [ 3446.335888]  88006ffd2068 88006ffdb008 0001 
 
 [ 3446.335888]  88006ffdb000  0003 
 0001
 [ 3446.335888] Call Trace:
 [ 3446.335888] __alloc_pages_nodemask (mm/page_alloc.c:2731)
 [ 3446.335888] ? __this_cpu_preempt_check (lib/smp_processor_id.c:63)
 [ 3446.335888] alloc_pages_vma (include/linux/mempolicy.h:76 
 mm/mempolicy.c:1998)
 [ 3446.335888] ? shmem_alloc_page (mm/shmem.c:881)
 [ 3446.335888] ? kvm_clock_read (arch/x86/include/asm/preempt.h:90 
 arch/x86/kernel/kvmclock.c:86)
 [ 3446.335888] shmem_alloc_page (mm/shmem.c:881)
 [ 3446.335888] ? __const_udelay (arch/x86/lib/delay.c:126)
 [ 3446.335888] ? __rcu_read_unlock (kernel/rcu/update.c:97)
 [ 3446.335888] ? find_get_entry (mm/filemap.c:979)
 [ 3446.335888] ? find_get_entry (mm/filemap.c:940)
 [ 3446.335888] ? find_lock_entry (mm/filemap.c:1024)
 [ 3446.335888] shmem_getpage_gfp (mm/shmem.c:1130)
 [ 3446.335888] ? sched_clock_local (kernel/sched/clock.c:214)
 [ 3446.335888] ? do_read_fault.isra.42 (mm/memory.c:3523)
 [ 3446.335888] shmem_fault (mm/shmem.c:1237)
 [ 3446.335888] ? do_read_fault.isra.42 (mm/memory.c:3523)
 [ 3446.335888] __do_fault (mm/memory.c:3344)
 [ 3446.335888] ? _raw_spin_unlock (arch/x86/include/asm/preempt.h:98 
 include/linux/spinlock_api_smp.h:152 kernel/locking/spinlock.c:183)
 [ 3446.335888] do_read_fault.isra.42 (mm/memory.c:3524)
 [ 3446.335888] ? get_parent_ip (kernel/sched/core.c:2485)
 [ 3446.335888] ? get_parent_ip (kernel/sched/core.c:2485)
 [ 3446.335888] __handle_mm_fault (mm/memory.c:3662 mm/memory.c:3823 
 mm/memory.c:3950)
 [ 3446.335888] ? __const_udelay (arch/x86/lib/delay.c:126)
 [ 3446.335888] ? __rcu_read_unlock (kernel/rcu/update.c:97)
 [ 3446.335888] handle_mm_fault (mm/memory.c:3973)
 [ 3446.335888] __get_user_pages (mm/memory.c:1863)
 [ 3446.335888] ? preempt_count_sub 

Re: [PATCH 2/2] mm/page_alloc: DEBUG_VM checks for free_list placement of CMA and RESERVE pages

2014-05-07 Thread Joonsoo Kim
On Wed, May 07, 2014 at 04:59:07PM +0200, Vlastimil Babka wrote:
 On 05/07/2014 03:33 AM, Minchan Kim wrote:
  On Mon, May 05, 2014 at 05:50:46PM +0200, Vlastimil Babka wrote:
  On 05/05/2014 04:36 PM, Sasha Levin wrote:
  On 05/02/2014 08:08 AM, Vlastimil Babka wrote:
  On 04/30/2014 11:46 PM, Sasha Levin wrote:
  On 04/03/2014 11:40 AM, Vlastimil Babka wrote:
  For the MIGRATE_RESERVE pages, it is important they do not get 
  misplaced
  on free_list of other migratetype, otherwise the whole 
  MIGRATE_RESERVE
  pageblock might be changed to other migratetype in 
  try_to_steal_freepages().
  For MIGRATE_CMA, the pages also must not go to a different 
  free_list, otherwise
  they could get allocated as unmovable and result in CMA failure.
 
  This is ensured by setting the freepage_migratetype appropriately 
  when placing
  pages on pcp lists, and using the information when releasing them 
  back to
  free_list. It is also assumed that CMA and RESERVE pageblocks are 
  created only
  in the init phase. This patch adds DEBUG_VM checks to catch any 
  regressions
  introduced for this invariant.
 
  Cc: Yong-Taek Lee ytk@samsung.com
  Cc: Bartlomiej Zolnierkiewicz b.zolnier...@samsung.com
  Cc: Joonsoo Kim iamjoonsoo@lge.com
  Cc: Mel Gorman mgor...@suse.de
  Cc: Minchan Kim minc...@kernel.org
  Cc: KOSAKI Motohiro kosaki.motoh...@jp.fujitsu.com
  Cc: Marek Szyprowski m.szyprow...@samsung.com
  Cc: Hugh Dickins hu...@google.com
  Cc: Rik van Riel r...@redhat.com
  Cc: Michal Nazarewicz min...@mina86.com
  Signed-off-by: Vlastimil Babka vba...@suse.cz
 
  Two issues with this patch.
 
  First:
 
  [ 3446.320082] kernel BUG at mm/page_alloc.c:1197!
  [ 3446.320082] invalid opcode:  [#1] PREEMPT SMP DEBUG_PAGEALLOC
  [ 3446.320082] Dumping ftrace buffer:
  [ 3446.320082](ftrace buffer empty)
  [ 3446.320082] Modules linked in:
  [ 3446.320082] CPU: 1 PID: 8923 Comm: trinity-c42 Not tainted 
  3.15.0-rc3-next-20140429-sasha-00015-g7c7e0a7-dirty #427
  [ 3446.320082] task: 88053e208000 ti: 88053e246000 task.ti: 
  88053e246000
  [ 3446.320082] RIP: get_page_from_freelist (mm/page_alloc.c:1197 
  mm/page_alloc.c:1548 mm/page_alloc.c:2036)
  [ 3446.320082] RSP: 0018:88053e247778  EFLAGS: 00010002
  [ 3446.320082] RAX: 0003 RBX: eaf4 RCX: 
  0008
  [ 3446.320082] RDX: 0002 RSI: 0003 RDI: 
  00a0
  [ 3446.320082] RBP: 88053e247868 R08: 0007 R09: 
  
  [ 3446.320082] R10: 88006ffcef00 R11:  R12: 
  0014
  [ 3446.335888] R13: ea000115ffe0 R14: ea000115ffe0 R15: 
  
  [ 3446.335888] FS:  7f8c9f059700() GS:88006ec0() 
  knlGS:
  [ 3446.335888] CS:  0010 DS:  ES:  CR0: 8005003b
  [ 3446.335888] CR2: 02cbc048 CR3: 00054cdb4000 CR4: 
  06a0
  [ 3446.335888] DR0: 006de000 DR1: 006de000 DR2: 
  
  [ 3446.335888] DR3:  DR6: 0ff0 DR7: 
  0602
  [ 3446.335888] Stack:
  [ 3446.335888]  88053e247798 88006eddc0b8 0016 
  
  [ 3446.335888]  88006ffd2068 88006ffdb008 0001 
  
  [ 3446.335888]  88006ffdb000  0003 
  0001
  [ 3446.335888] Call Trace:
  [ 3446.335888] __alloc_pages_nodemask (mm/page_alloc.c:2731)
  [ 3446.335888] ? __this_cpu_preempt_check (lib/smp_processor_id.c:63)
  [ 3446.335888] alloc_pages_vma (include/linux/mempolicy.h:76 
  mm/mempolicy.c:1998)
  [ 3446.335888] ? shmem_alloc_page (mm/shmem.c:881)
  [ 3446.335888] ? kvm_clock_read (arch/x86/include/asm/preempt.h:90 
  arch/x86/kernel/kvmclock.c:86)
  [ 3446.335888] shmem_alloc_page (mm/shmem.c:881)
  [ 3446.335888] ? __const_udelay (arch/x86/lib/delay.c:126)
  [ 3446.335888] ? __rcu_read_unlock (kernel/rcu/update.c:97)
  [ 3446.335888] ? find_get_entry (mm/filemap.c:979)
  [ 3446.335888] ? find_get_entry (mm/filemap.c:940)
  [ 3446.335888] ? find_lock_entry (mm/filemap.c:1024)
  [ 3446.335888] shmem_getpage_gfp (mm/shmem.c:1130)
  [ 3446.335888] ? sched_clock_local (kernel/sched/clock.c:214)
  [ 3446.335888] ? do_read_fault.isra.42 (mm/memory.c:3523)
  [ 3446.335888] shmem_fault (mm/shmem.c:1237)
  [ 3446.335888] ? do_read_fault.isra.42 (mm/memory.c:3523)
  [ 3446.335888] __do_fault (mm/memory.c:3344)
  [ 3446.335888] ? _raw_spin_unlock (arch/x86/include/asm/preempt.h:98 
  include/linux/spinlock_api_smp.h:152 kernel/locking/spinlock.c:183)
  [ 3446.335888] do_read_fault.isra.42 (mm/memory.c:3524)
  [ 3446.335888] ? get_parent_ip (kernel/sched/core.c:2485)
  [ 3446.335888] ? get_parent_ip (kernel/sched/core.c:2485)
  [ 3446.335888] __handle_mm_fault (mm/memory.c:3662 mm/memory.c:3823 
  mm/memory.c:3950)
  [ 3446.335888] ? __const_udelay (arch/x86/lib/delay.c:126)
  [ 3446.335888] ? __rcu_read_unlock 

Re: [PATCH 2/2] mm/page_alloc: DEBUG_VM checks for free_list placement of CMA and RESERVE pages

2014-05-06 Thread Minchan Kim
On Mon, May 05, 2014 at 05:50:46PM +0200, Vlastimil Babka wrote:
> On 05/05/2014 04:36 PM, Sasha Levin wrote:
> >On 05/02/2014 08:08 AM, Vlastimil Babka wrote:
> >>On 04/30/2014 11:46 PM, Sasha Levin wrote:
> On 04/03/2014 11:40 AM, Vlastimil Babka wrote:
> >>For the MIGRATE_RESERVE pages, it is important they do not get misplaced
> >>on free_list of other migratetype, otherwise the whole MIGRATE_RESERVE
> >>pageblock might be changed to other migratetype in 
> >>try_to_steal_freepages().
> >>For MIGRATE_CMA, the pages also must not go to a different free_list, 
> >>otherwise
> >>they could get allocated as unmovable and result in CMA failure.
> >>
> >>This is ensured by setting the freepage_migratetype appropriately when 
> >>placing
> >>pages on pcp lists, and using the information when releasing them back 
> >>to
> >>free_list. It is also assumed that CMA and RESERVE pageblocks are 
> >>created only
> >>in the init phase. This patch adds DEBUG_VM checks to catch any 
> >>regressions
> >>introduced for this invariant.
> >>
> >>Cc: Yong-Taek Lee 
> >>Cc: Bartlomiej Zolnierkiewicz 
> >>Cc: Joonsoo Kim 
> >>Cc: Mel Gorman 
> >>Cc: Minchan Kim 
> >>Cc: KOSAKI Motohiro 
> >>Cc: Marek Szyprowski 
> >>Cc: Hugh Dickins 
> >>Cc: Rik van Riel 
> >>Cc: Michal Nazarewicz 
> >>Signed-off-by: Vlastimil Babka 
> 
> Two issues with this patch.
> 
> First:
> 
> [ 3446.320082] kernel BUG at mm/page_alloc.c:1197!
> [ 3446.320082] invalid opcode:  [#1] PREEMPT SMP DEBUG_PAGEALLOC
> [ 3446.320082] Dumping ftrace buffer:
> [ 3446.320082](ftrace buffer empty)
> [ 3446.320082] Modules linked in:
> [ 3446.320082] CPU: 1 PID: 8923 Comm: trinity-c42 Not tainted 
> 3.15.0-rc3-next-20140429-sasha-00015-g7c7e0a7-dirty #427
> [ 3446.320082] task: 88053e208000 ti: 88053e246000 task.ti: 
> 88053e246000
> [ 3446.320082] RIP: get_page_from_freelist (mm/page_alloc.c:1197 
> mm/page_alloc.c:1548 mm/page_alloc.c:2036)
> [ 3446.320082] RSP: 0018:88053e247778  EFLAGS: 00010002
> [ 3446.320082] RAX: 0003 RBX: eaf4 RCX: 
> 0008
> [ 3446.320082] RDX: 0002 RSI: 0003 RDI: 
> 00a0
> [ 3446.320082] RBP: 88053e247868 R08: 0007 R09: 
> 
> [ 3446.320082] R10: 88006ffcef00 R11:  R12: 
> 0014
> [ 3446.335888] R13: ea000115ffe0 R14: ea000115ffe0 R15: 
> 
> [ 3446.335888] FS:  7f8c9f059700() GS:88006ec0() 
> knlGS:
> [ 3446.335888] CS:  0010 DS:  ES:  CR0: 8005003b
> [ 3446.335888] CR2: 02cbc048 CR3: 00054cdb4000 CR4: 
> 06a0
> [ 3446.335888] DR0: 006de000 DR1: 006de000 DR2: 
> 
> [ 3446.335888] DR3:  DR6: 0ff0 DR7: 
> 0602
> [ 3446.335888] Stack:
> [ 3446.335888]  88053e247798 88006eddc0b8 0016 
> 
> [ 3446.335888]  88006ffd2068 88006ffdb008 0001 
> 
> [ 3446.335888]  88006ffdb000  0003 
> 0001
> [ 3446.335888] Call Trace:
> [ 3446.335888] __alloc_pages_nodemask (mm/page_alloc.c:2731)
> [ 3446.335888] ? __this_cpu_preempt_check (lib/smp_processor_id.c:63)
> [ 3446.335888] alloc_pages_vma (include/linux/mempolicy.h:76 
> mm/mempolicy.c:1998)
> [ 3446.335888] ? shmem_alloc_page (mm/shmem.c:881)
> [ 3446.335888] ? kvm_clock_read (arch/x86/include/asm/preempt.h:90 
> arch/x86/kernel/kvmclock.c:86)
> [ 3446.335888] shmem_alloc_page (mm/shmem.c:881)
> [ 3446.335888] ? __const_udelay (arch/x86/lib/delay.c:126)
> [ 3446.335888] ? __rcu_read_unlock (kernel/rcu/update.c:97)
> [ 3446.335888] ? find_get_entry (mm/filemap.c:979)
> [ 3446.335888] ? find_get_entry (mm/filemap.c:940)
> [ 3446.335888] ? find_lock_entry (mm/filemap.c:1024)
> [ 3446.335888] shmem_getpage_gfp (mm/shmem.c:1130)
> [ 3446.335888] ? sched_clock_local (kernel/sched/clock.c:214)
> [ 3446.335888] ? do_read_fault.isra.42 (mm/memory.c:3523)
> [ 3446.335888] shmem_fault (mm/shmem.c:1237)
> [ 3446.335888] ? do_read_fault.isra.42 (mm/memory.c:3523)
> [ 3446.335888] __do_fault (mm/memory.c:3344)
> [ 3446.335888] ? _raw_spin_unlock (arch/x86/include/asm/preempt.h:98 
> include/linux/spinlock_api_smp.h:152 kernel/locking/spinlock.c:183)
> [ 3446.335888] do_read_fault.isra.42 (mm/memory.c:3524)
> [ 3446.335888] ? get_parent_ip (kernel/sched/core.c:2485)
> [ 3446.335888] ? get_parent_ip (kernel/sched/core.c:2485)
> [ 3446.335888] __handle_mm_fault (mm/memory.c:3662 

Re: [PATCH 2/2] mm/page_alloc: DEBUG_VM checks for free_list placement of CMA and RESERVE pages

2014-05-06 Thread Minchan Kim
On Mon, May 05, 2014 at 05:50:46PM +0200, Vlastimil Babka wrote:
 On 05/05/2014 04:36 PM, Sasha Levin wrote:
 On 05/02/2014 08:08 AM, Vlastimil Babka wrote:
 On 04/30/2014 11:46 PM, Sasha Levin wrote:
 On 04/03/2014 11:40 AM, Vlastimil Babka wrote:
 For the MIGRATE_RESERVE pages, it is important they do not get misplaced
 on free_list of other migratetype, otherwise the whole MIGRATE_RESERVE
 pageblock might be changed to other migratetype in 
 try_to_steal_freepages().
 For MIGRATE_CMA, the pages also must not go to a different free_list, 
 otherwise
 they could get allocated as unmovable and result in CMA failure.
 
 This is ensured by setting the freepage_migratetype appropriately when 
 placing
 pages on pcp lists, and using the information when releasing them back 
 to
 free_list. It is also assumed that CMA and RESERVE pageblocks are 
 created only
 in the init phase. This patch adds DEBUG_VM checks to catch any 
 regressions
 introduced for this invariant.
 
 Cc: Yong-Taek Lee ytk@samsung.com
 Cc: Bartlomiej Zolnierkiewicz b.zolnier...@samsung.com
 Cc: Joonsoo Kim iamjoonsoo@lge.com
 Cc: Mel Gorman mgor...@suse.de
 Cc: Minchan Kim minc...@kernel.org
 Cc: KOSAKI Motohiro kosaki.motoh...@jp.fujitsu.com
 Cc: Marek Szyprowski m.szyprow...@samsung.com
 Cc: Hugh Dickins hu...@google.com
 Cc: Rik van Riel r...@redhat.com
 Cc: Michal Nazarewicz min...@mina86.com
 Signed-off-by: Vlastimil Babka vba...@suse.cz
 
 Two issues with this patch.
 
 First:
 
 [ 3446.320082] kernel BUG at mm/page_alloc.c:1197!
 [ 3446.320082] invalid opcode:  [#1] PREEMPT SMP DEBUG_PAGEALLOC
 [ 3446.320082] Dumping ftrace buffer:
 [ 3446.320082](ftrace buffer empty)
 [ 3446.320082] Modules linked in:
 [ 3446.320082] CPU: 1 PID: 8923 Comm: trinity-c42 Not tainted 
 3.15.0-rc3-next-20140429-sasha-00015-g7c7e0a7-dirty #427
 [ 3446.320082] task: 88053e208000 ti: 88053e246000 task.ti: 
 88053e246000
 [ 3446.320082] RIP: get_page_from_freelist (mm/page_alloc.c:1197 
 mm/page_alloc.c:1548 mm/page_alloc.c:2036)
 [ 3446.320082] RSP: 0018:88053e247778  EFLAGS: 00010002
 [ 3446.320082] RAX: 0003 RBX: eaf4 RCX: 
 0008
 [ 3446.320082] RDX: 0002 RSI: 0003 RDI: 
 00a0
 [ 3446.320082] RBP: 88053e247868 R08: 0007 R09: 
 
 [ 3446.320082] R10: 88006ffcef00 R11:  R12: 
 0014
 [ 3446.335888] R13: ea000115ffe0 R14: ea000115ffe0 R15: 
 
 [ 3446.335888] FS:  7f8c9f059700() GS:88006ec0() 
 knlGS:
 [ 3446.335888] CS:  0010 DS:  ES:  CR0: 8005003b
 [ 3446.335888] CR2: 02cbc048 CR3: 00054cdb4000 CR4: 
 06a0
 [ 3446.335888] DR0: 006de000 DR1: 006de000 DR2: 
 
 [ 3446.335888] DR3:  DR6: 0ff0 DR7: 
 0602
 [ 3446.335888] Stack:
 [ 3446.335888]  88053e247798 88006eddc0b8 0016 
 
 [ 3446.335888]  88006ffd2068 88006ffdb008 0001 
 
 [ 3446.335888]  88006ffdb000  0003 
 0001
 [ 3446.335888] Call Trace:
 [ 3446.335888] __alloc_pages_nodemask (mm/page_alloc.c:2731)
 [ 3446.335888] ? __this_cpu_preempt_check (lib/smp_processor_id.c:63)
 [ 3446.335888] alloc_pages_vma (include/linux/mempolicy.h:76 
 mm/mempolicy.c:1998)
 [ 3446.335888] ? shmem_alloc_page (mm/shmem.c:881)
 [ 3446.335888] ? kvm_clock_read (arch/x86/include/asm/preempt.h:90 
 arch/x86/kernel/kvmclock.c:86)
 [ 3446.335888] shmem_alloc_page (mm/shmem.c:881)
 [ 3446.335888] ? __const_udelay (arch/x86/lib/delay.c:126)
 [ 3446.335888] ? __rcu_read_unlock (kernel/rcu/update.c:97)
 [ 3446.335888] ? find_get_entry (mm/filemap.c:979)
 [ 3446.335888] ? find_get_entry (mm/filemap.c:940)
 [ 3446.335888] ? find_lock_entry (mm/filemap.c:1024)
 [ 3446.335888] shmem_getpage_gfp (mm/shmem.c:1130)
 [ 3446.335888] ? sched_clock_local (kernel/sched/clock.c:214)
 [ 3446.335888] ? do_read_fault.isra.42 (mm/memory.c:3523)
 [ 3446.335888] shmem_fault (mm/shmem.c:1237)
 [ 3446.335888] ? do_read_fault.isra.42 (mm/memory.c:3523)
 [ 3446.335888] __do_fault (mm/memory.c:3344)
 [ 3446.335888] ? _raw_spin_unlock (arch/x86/include/asm/preempt.h:98 
 include/linux/spinlock_api_smp.h:152 kernel/locking/spinlock.c:183)
 [ 3446.335888] do_read_fault.isra.42 (mm/memory.c:3524)
 [ 3446.335888] ? get_parent_ip (kernel/sched/core.c:2485)
 [ 3446.335888] ? get_parent_ip (kernel/sched/core.c:2485)
 [ 3446.335888] __handle_mm_fault (mm/memory.c:3662 mm/memory.c:3823 
 mm/memory.c:3950)
 [ 3446.335888] ? __const_udelay (arch/x86/lib/delay.c:126)
 [ 3446.335888] ? __rcu_read_unlock (kernel/rcu/update.c:97)
 [ 3446.335888] handle_mm_fault (mm/memory.c:3973)
 [ 3446.335888] __get_user_pages (mm/memory.c:1863)
 [ 3446.335888] ? preempt_count_sub (kernel/sched/core.c:2541)
 [ 3446.335888] 

Re: [PATCH 2/2] mm/page_alloc: DEBUG_VM checks for free_list placement of CMA and RESERVE pages

2014-05-05 Thread Sasha Levin
On 05/05/2014 11:50 AM, Vlastimil Babka wrote:
> On 05/05/2014 04:36 PM, Sasha Levin wrote:
>> On 05/02/2014 08:08 AM, Vlastimil Babka wrote:
>>> On 04/30/2014 11:46 PM, Sasha Levin wrote:
> On 04/03/2014 11:40 AM, Vlastimil Babka wrote:
>>> For the MIGRATE_RESERVE pages, it is important they do not get misplaced
>>> on free_list of other migratetype, otherwise the whole MIGRATE_RESERVE
>>> pageblock might be changed to other migratetype in 
>>> try_to_steal_freepages().
>>> For MIGRATE_CMA, the pages also must not go to a different free_list, 
>>> otherwise
>>> they could get allocated as unmovable and result in CMA failure.
>>>
>>> This is ensured by setting the freepage_migratetype appropriately when 
>>> placing
>>> pages on pcp lists, and using the information when releasing them back 
>>> to
>>> free_list. It is also assumed that CMA and RESERVE pageblocks are 
>>> created only
>>> in the init phase. This patch adds DEBUG_VM checks to catch any 
>>> regressions
>>> introduced for this invariant.
>>>
>>> Cc: Yong-Taek Lee 
>>> Cc: Bartlomiej Zolnierkiewicz 
>>> Cc: Joonsoo Kim 
>>> Cc: Mel Gorman 
>>> Cc: Minchan Kim 
>>> Cc: KOSAKI Motohiro 
>>> Cc: Marek Szyprowski 
>>> Cc: Hugh Dickins 
>>> Cc: Rik van Riel 
>>> Cc: Michal Nazarewicz 
>>> Signed-off-by: Vlastimil Babka 
>
> Two issues with this patch.
>
> First:
>
> [ 3446.320082] kernel BUG at mm/page_alloc.c:1197!
> [ 3446.320082] invalid opcode:  [#1] PREEMPT SMP DEBUG_PAGEALLOC
> [ 3446.320082] Dumping ftrace buffer:
> [ 3446.320082](ftrace buffer empty)
> [ 3446.320082] Modules linked in:
> [ 3446.320082] CPU: 1 PID: 8923 Comm: trinity-c42 Not tainted 
> 3.15.0-rc3-next-20140429-sasha-00015-g7c7e0a7-dirty #427
> [ 3446.320082] task: 88053e208000 ti: 88053e246000 task.ti: 
> 88053e246000
> [ 3446.320082] RIP: get_page_from_freelist (mm/page_alloc.c:1197 
> mm/page_alloc.c:1548 mm/page_alloc.c:2036)
> [ 3446.320082] RSP: 0018:88053e247778  EFLAGS: 00010002
> [ 3446.320082] RAX: 0003 RBX: eaf4 RCX: 
> 0008
> [ 3446.320082] RDX: 0002 RSI: 0003 RDI: 
> 00a0
> [ 3446.320082] RBP: 88053e247868 R08: 0007 R09: 
> 
> [ 3446.320082] R10: 88006ffcef00 R11:  R12: 
> 0014
> [ 3446.335888] R13: ea000115ffe0 R14: ea000115ffe0 R15: 
> 
> [ 3446.335888] FS:  7f8c9f059700() GS:88006ec0() 
> knlGS:
> [ 3446.335888] CS:  0010 DS:  ES:  CR0: 8005003b
> [ 3446.335888] CR2: 02cbc048 CR3: 00054cdb4000 CR4: 
> 06a0
> [ 3446.335888] DR0: 006de000 DR1: 006de000 DR2: 
> 
> [ 3446.335888] DR3:  DR6: 0ff0 DR7: 
> 0602
> [ 3446.335888] Stack:
> [ 3446.335888]  88053e247798 88006eddc0b8 0016 
> 
> [ 3446.335888]  88006ffd2068 88006ffdb008 0001 
> 
> [ 3446.335888]  88006ffdb000  0003 
> 0001
> [ 3446.335888] Call Trace:
> [ 3446.335888] __alloc_pages_nodemask (mm/page_alloc.c:2731)
> [ 3446.335888] ? __this_cpu_preempt_check (lib/smp_processor_id.c:63)
> [ 3446.335888] alloc_pages_vma (include/linux/mempolicy.h:76 
> mm/mempolicy.c:1998)
> [ 3446.335888] ? shmem_alloc_page (mm/shmem.c:881)
> [ 3446.335888] ? kvm_clock_read (arch/x86/include/asm/preempt.h:90 
> arch/x86/kernel/kvmclock.c:86)
> [ 3446.335888] shmem_alloc_page (mm/shmem.c:881)
> [ 3446.335888] ? __const_udelay (arch/x86/lib/delay.c:126)
> [ 3446.335888] ? __rcu_read_unlock (kernel/rcu/update.c:97)
> [ 3446.335888] ? find_get_entry (mm/filemap.c:979)
> [ 3446.335888] ? find_get_entry (mm/filemap.c:940)
> [ 3446.335888] ? find_lock_entry (mm/filemap.c:1024)
> [ 3446.335888] shmem_getpage_gfp (mm/shmem.c:1130)
> [ 3446.335888] ? sched_clock_local (kernel/sched/clock.c:214)
> [ 3446.335888] ? do_read_fault.isra.42 (mm/memory.c:3523)
> [ 3446.335888] shmem_fault (mm/shmem.c:1237)
> [ 3446.335888] ? do_read_fault.isra.42 (mm/memory.c:3523)
> [ 3446.335888] __do_fault (mm/memory.c:3344)
> [ 3446.335888] ? _raw_spin_unlock (arch/x86/include/asm/preempt.h:98 
> include/linux/spinlock_api_smp.h:152 kernel/locking/spinlock.c:183)
> [ 3446.335888] do_read_fault.isra.42 (mm/memory.c:3524)
> [ 3446.335888] ? get_parent_ip (kernel/sched/core.c:2485)
> [ 3446.335888] ? get_parent_ip (kernel/sched/core.c:2485)
> [ 3446.335888] __handle_mm_fault (mm/memory.c:3662 mm/memory.c:3823 
> 

Re: [PATCH 2/2] mm/page_alloc: DEBUG_VM checks for free_list placement of CMA and RESERVE pages

2014-05-05 Thread Vlastimil Babka

On 05/05/2014 04:36 PM, Sasha Levin wrote:

On 05/02/2014 08:08 AM, Vlastimil Babka wrote:

On 04/30/2014 11:46 PM, Sasha Levin wrote:

On 04/03/2014 11:40 AM, Vlastimil Babka wrote:

For the MIGRATE_RESERVE pages, it is important they do not get misplaced
on free_list of other migratetype, otherwise the whole MIGRATE_RESERVE
pageblock might be changed to other migratetype in try_to_steal_freepages().
For MIGRATE_CMA, the pages also must not go to a different free_list, otherwise
they could get allocated as unmovable and result in CMA failure.

This is ensured by setting the freepage_migratetype appropriately when placing
pages on pcp lists, and using the information when releasing them back to
free_list. It is also assumed that CMA and RESERVE pageblocks are created only
in the init phase. This patch adds DEBUG_VM checks to catch any regressions
introduced for this invariant.

Cc: Yong-Taek Lee 
Cc: Bartlomiej Zolnierkiewicz 
Cc: Joonsoo Kim 
Cc: Mel Gorman 
Cc: Minchan Kim 
Cc: KOSAKI Motohiro 
Cc: Marek Szyprowski 
Cc: Hugh Dickins 
Cc: Rik van Riel 
Cc: Michal Nazarewicz 
Signed-off-by: Vlastimil Babka 


Two issues with this patch.

First:

[ 3446.320082] kernel BUG at mm/page_alloc.c:1197!
[ 3446.320082] invalid opcode:  [#1] PREEMPT SMP DEBUG_PAGEALLOC
[ 3446.320082] Dumping ftrace buffer:
[ 3446.320082](ftrace buffer empty)
[ 3446.320082] Modules linked in:
[ 3446.320082] CPU: 1 PID: 8923 Comm: trinity-c42 Not tainted 
3.15.0-rc3-next-20140429-sasha-00015-g7c7e0a7-dirty #427
[ 3446.320082] task: 88053e208000 ti: 88053e246000 task.ti: 
88053e246000
[ 3446.320082] RIP: get_page_from_freelist (mm/page_alloc.c:1197 
mm/page_alloc.c:1548 mm/page_alloc.c:2036)
[ 3446.320082] RSP: 0018:88053e247778  EFLAGS: 00010002
[ 3446.320082] RAX: 0003 RBX: eaf4 RCX: 0008
[ 3446.320082] RDX: 0002 RSI: 0003 RDI: 00a0
[ 3446.320082] RBP: 88053e247868 R08: 0007 R09: 
[ 3446.320082] R10: 88006ffcef00 R11:  R12: 0014
[ 3446.335888] R13: ea000115ffe0 R14: ea000115ffe0 R15: 
[ 3446.335888] FS:  7f8c9f059700() GS:88006ec0() 
knlGS:
[ 3446.335888] CS:  0010 DS:  ES:  CR0: 8005003b
[ 3446.335888] CR2: 02cbc048 CR3: 00054cdb4000 CR4: 06a0
[ 3446.335888] DR0: 006de000 DR1: 006de000 DR2: 
[ 3446.335888] DR3:  DR6: 0ff0 DR7: 0602
[ 3446.335888] Stack:
[ 3446.335888]  88053e247798 88006eddc0b8 0016 

[ 3446.335888]  88006ffd2068 88006ffdb008 0001 

[ 3446.335888]  88006ffdb000  0003 
0001
[ 3446.335888] Call Trace:
[ 3446.335888] __alloc_pages_nodemask (mm/page_alloc.c:2731)
[ 3446.335888] ? __this_cpu_preempt_check (lib/smp_processor_id.c:63)
[ 3446.335888] alloc_pages_vma (include/linux/mempolicy.h:76 
mm/mempolicy.c:1998)
[ 3446.335888] ? shmem_alloc_page (mm/shmem.c:881)
[ 3446.335888] ? kvm_clock_read (arch/x86/include/asm/preempt.h:90 
arch/x86/kernel/kvmclock.c:86)
[ 3446.335888] shmem_alloc_page (mm/shmem.c:881)
[ 3446.335888] ? __const_udelay (arch/x86/lib/delay.c:126)
[ 3446.335888] ? __rcu_read_unlock (kernel/rcu/update.c:97)
[ 3446.335888] ? find_get_entry (mm/filemap.c:979)
[ 3446.335888] ? find_get_entry (mm/filemap.c:940)
[ 3446.335888] ? find_lock_entry (mm/filemap.c:1024)
[ 3446.335888] shmem_getpage_gfp (mm/shmem.c:1130)
[ 3446.335888] ? sched_clock_local (kernel/sched/clock.c:214)
[ 3446.335888] ? do_read_fault.isra.42 (mm/memory.c:3523)
[ 3446.335888] shmem_fault (mm/shmem.c:1237)
[ 3446.335888] ? do_read_fault.isra.42 (mm/memory.c:3523)
[ 3446.335888] __do_fault (mm/memory.c:3344)
[ 3446.335888] ? _raw_spin_unlock (arch/x86/include/asm/preempt.h:98 
include/linux/spinlock_api_smp.h:152 kernel/locking/spinlock.c:183)
[ 3446.335888] do_read_fault.isra.42 (mm/memory.c:3524)
[ 3446.335888] ? get_parent_ip (kernel/sched/core.c:2485)
[ 3446.335888] ? get_parent_ip (kernel/sched/core.c:2485)
[ 3446.335888] __handle_mm_fault (mm/memory.c:3662 mm/memory.c:3823 
mm/memory.c:3950)
[ 3446.335888] ? __const_udelay (arch/x86/lib/delay.c:126)
[ 3446.335888] ? __rcu_read_unlock (kernel/rcu/update.c:97)
[ 3446.335888] handle_mm_fault (mm/memory.c:3973)
[ 3446.335888] __get_user_pages (mm/memory.c:1863)
[ 3446.335888] ? preempt_count_sub (kernel/sched/core.c:2541)
[ 3446.335888] __mlock_vma_pages_range (mm/mlock.c:255)
[ 3446.335888] __mm_populate (mm/mlock.c:711)
[ 3446.335888] vm_mmap_pgoff (include/linux/mm.h:1841 mm/util.c:402)
[ 3446.335888] SyS_mmap_pgoff (mm/mmap.c:1378)
[ 3446.335888] ? syscall_trace_enter (include/linux/context_tracking.h:27 
arch/x86/kernel/ptrace.c:1461)
[ 3446.335888] ia32_do_call (arch/x86/ia32/ia32entry.S:430)
[ 3446.335888] Code: 00 66 0f 1f 44 00 00 ba 02 

Re: [PATCH 2/2] mm/page_alloc: DEBUG_VM checks for free_list placement of CMA and RESERVE pages

2014-05-05 Thread Sasha Levin
On 05/02/2014 08:08 AM, Vlastimil Babka wrote:
> On 04/30/2014 11:46 PM, Sasha Levin wrote:
>> > On 04/03/2014 11:40 AM, Vlastimil Babka wrote:
>>> >> For the MIGRATE_RESERVE pages, it is important they do not get misplaced
>>> >> on free_list of other migratetype, otherwise the whole MIGRATE_RESERVE
>>> >> pageblock might be changed to other migratetype in 
>>> >> try_to_steal_freepages().
>>> >> For MIGRATE_CMA, the pages also must not go to a different free_list, 
>>> >> otherwise
>>> >> they could get allocated as unmovable and result in CMA failure.
>>> >>
>>> >> This is ensured by setting the freepage_migratetype appropriately when 
>>> >> placing
>>> >> pages on pcp lists, and using the information when releasing them back to
>>> >> free_list. It is also assumed that CMA and RESERVE pageblocks are 
>>> >> created only
>>> >> in the init phase. This patch adds DEBUG_VM checks to catch any 
>>> >> regressions
>>> >> introduced for this invariant.
>>> >>
>>> >> Cc: Yong-Taek Lee 
>>> >> Cc: Bartlomiej Zolnierkiewicz 
>>> >> Cc: Joonsoo Kim 
>>> >> Cc: Mel Gorman 
>>> >> Cc: Minchan Kim 
>>> >> Cc: KOSAKI Motohiro 
>>> >> Cc: Marek Szyprowski 
>>> >> Cc: Hugh Dickins 
>>> >> Cc: Rik van Riel 
>>> >> Cc: Michal Nazarewicz 
>>> >> Signed-off-by: Vlastimil Babka 
>> > 
>> > Two issues with this patch.
>> > 
>> > First:
>> > 
>> > [ 3446.320082] kernel BUG at mm/page_alloc.c:1197!
>> > [ 3446.320082] invalid opcode:  [#1] PREEMPT SMP DEBUG_PAGEALLOC
>> > [ 3446.320082] Dumping ftrace buffer:
>> > [ 3446.320082](ftrace buffer empty)
>> > [ 3446.320082] Modules linked in:
>> > [ 3446.320082] CPU: 1 PID: 8923 Comm: trinity-c42 Not tainted 
>> > 3.15.0-rc3-next-20140429-sasha-00015-g7c7e0a7-dirty #427
>> > [ 3446.320082] task: 88053e208000 ti: 88053e246000 task.ti: 
>> > 88053e246000
>> > [ 3446.320082] RIP: get_page_from_freelist (mm/page_alloc.c:1197 
>> > mm/page_alloc.c:1548 mm/page_alloc.c:2036)
>> > [ 3446.320082] RSP: 0018:88053e247778  EFLAGS: 00010002
>> > [ 3446.320082] RAX: 0003 RBX: eaf4 RCX: 
>> > 0008
>> > [ 3446.320082] RDX: 0002 RSI: 0003 RDI: 
>> > 00a0
>> > [ 3446.320082] RBP: 88053e247868 R08: 0007 R09: 
>> > 
>> > [ 3446.320082] R10: 88006ffcef00 R11:  R12: 
>> > 0014
>> > [ 3446.335888] R13: ea000115ffe0 R14: ea000115ffe0 R15: 
>> > 
>> > [ 3446.335888] FS:  7f8c9f059700() GS:88006ec0() 
>> > knlGS:
>> > [ 3446.335888] CS:  0010 DS:  ES:  CR0: 8005003b
>> > [ 3446.335888] CR2: 02cbc048 CR3: 00054cdb4000 CR4: 
>> > 06a0
>> > [ 3446.335888] DR0: 006de000 DR1: 006de000 DR2: 
>> > 
>> > [ 3446.335888] DR3:  DR6: 0ff0 DR7: 
>> > 0602
>> > [ 3446.335888] Stack:
>> > [ 3446.335888]  88053e247798 88006eddc0b8 0016 
>> > 
>> > [ 3446.335888]  88006ffd2068 88006ffdb008 0001 
>> > 
>> > [ 3446.335888]  88006ffdb000  0003 
>> > 0001
>> > [ 3446.335888] Call Trace:
>> > [ 3446.335888] __alloc_pages_nodemask (mm/page_alloc.c:2731)
>> > [ 3446.335888] ? __this_cpu_preempt_check (lib/smp_processor_id.c:63)
>> > [ 3446.335888] alloc_pages_vma (include/linux/mempolicy.h:76 
>> > mm/mempolicy.c:1998)
>> > [ 3446.335888] ? shmem_alloc_page (mm/shmem.c:881)
>> > [ 3446.335888] ? kvm_clock_read (arch/x86/include/asm/preempt.h:90 
>> > arch/x86/kernel/kvmclock.c:86)
>> > [ 3446.335888] shmem_alloc_page (mm/shmem.c:881)
>> > [ 3446.335888] ? __const_udelay (arch/x86/lib/delay.c:126)
>> > [ 3446.335888] ? __rcu_read_unlock (kernel/rcu/update.c:97)
>> > [ 3446.335888] ? find_get_entry (mm/filemap.c:979)
>> > [ 3446.335888] ? find_get_entry (mm/filemap.c:940)
>> > [ 3446.335888] ? find_lock_entry (mm/filemap.c:1024)
>> > [ 3446.335888] shmem_getpage_gfp (mm/shmem.c:1130)
>> > [ 3446.335888] ? sched_clock_local (kernel/sched/clock.c:214)
>> > [ 3446.335888] ? do_read_fault.isra.42 (mm/memory.c:3523)
>> > [ 3446.335888] shmem_fault (mm/shmem.c:1237)
>> > [ 3446.335888] ? do_read_fault.isra.42 (mm/memory.c:3523)
>> > [ 3446.335888] __do_fault (mm/memory.c:3344)
>> > [ 3446.335888] ? _raw_spin_unlock (arch/x86/include/asm/preempt.h:98 
>> > include/linux/spinlock_api_smp.h:152 kernel/locking/spinlock.c:183)
>> > [ 3446.335888] do_read_fault.isra.42 (mm/memory.c:3524)
>> > [ 3446.335888] ? get_parent_ip (kernel/sched/core.c:2485)
>> > [ 3446.335888] ? get_parent_ip (kernel/sched/core.c:2485)
>> > [ 3446.335888] __handle_mm_fault (mm/memory.c:3662 mm/memory.c:3823 
>> > mm/memory.c:3950)
>> > [ 3446.335888] ? __const_udelay (arch/x86/lib/delay.c:126)
>> > [ 3446.335888] ? __rcu_read_unlock (kernel/rcu/update.c:97)
>> > [ 3446.335888] handle_mm_fault (mm/memory.c:3973)
>> > [ 

Re: [PATCH 2/2] mm/page_alloc: DEBUG_VM checks for free_list placement of CMA and RESERVE pages

2014-05-05 Thread Sasha Levin
On 05/02/2014 08:08 AM, Vlastimil Babka wrote:
 On 04/30/2014 11:46 PM, Sasha Levin wrote:
  On 04/03/2014 11:40 AM, Vlastimil Babka wrote:
  For the MIGRATE_RESERVE pages, it is important they do not get misplaced
  on free_list of other migratetype, otherwise the whole MIGRATE_RESERVE
  pageblock might be changed to other migratetype in 
  try_to_steal_freepages().
  For MIGRATE_CMA, the pages also must not go to a different free_list, 
  otherwise
  they could get allocated as unmovable and result in CMA failure.
 
  This is ensured by setting the freepage_migratetype appropriately when 
  placing
  pages on pcp lists, and using the information when releasing them back to
  free_list. It is also assumed that CMA and RESERVE pageblocks are 
  created only
  in the init phase. This patch adds DEBUG_VM checks to catch any 
  regressions
  introduced for this invariant.
 
  Cc: Yong-Taek Lee ytk@samsung.com
  Cc: Bartlomiej Zolnierkiewicz b.zolnier...@samsung.com
  Cc: Joonsoo Kim iamjoonsoo@lge.com
  Cc: Mel Gorman mgor...@suse.de
  Cc: Minchan Kim minc...@kernel.org
  Cc: KOSAKI Motohiro kosaki.motoh...@jp.fujitsu.com
  Cc: Marek Szyprowski m.szyprow...@samsung.com
  Cc: Hugh Dickins hu...@google.com
  Cc: Rik van Riel r...@redhat.com
  Cc: Michal Nazarewicz min...@mina86.com
  Signed-off-by: Vlastimil Babka vba...@suse.cz
  
  Two issues with this patch.
  
  First:
  
  [ 3446.320082] kernel BUG at mm/page_alloc.c:1197!
  [ 3446.320082] invalid opcode:  [#1] PREEMPT SMP DEBUG_PAGEALLOC
  [ 3446.320082] Dumping ftrace buffer:
  [ 3446.320082](ftrace buffer empty)
  [ 3446.320082] Modules linked in:
  [ 3446.320082] CPU: 1 PID: 8923 Comm: trinity-c42 Not tainted 
  3.15.0-rc3-next-20140429-sasha-00015-g7c7e0a7-dirty #427
  [ 3446.320082] task: 88053e208000 ti: 88053e246000 task.ti: 
  88053e246000
  [ 3446.320082] RIP: get_page_from_freelist (mm/page_alloc.c:1197 
  mm/page_alloc.c:1548 mm/page_alloc.c:2036)
  [ 3446.320082] RSP: 0018:88053e247778  EFLAGS: 00010002
  [ 3446.320082] RAX: 0003 RBX: eaf4 RCX: 
  0008
  [ 3446.320082] RDX: 0002 RSI: 0003 RDI: 
  00a0
  [ 3446.320082] RBP: 88053e247868 R08: 0007 R09: 
  
  [ 3446.320082] R10: 88006ffcef00 R11:  R12: 
  0014
  [ 3446.335888] R13: ea000115ffe0 R14: ea000115ffe0 R15: 
  
  [ 3446.335888] FS:  7f8c9f059700() GS:88006ec0() 
  knlGS:
  [ 3446.335888] CS:  0010 DS:  ES:  CR0: 8005003b
  [ 3446.335888] CR2: 02cbc048 CR3: 00054cdb4000 CR4: 
  06a0
  [ 3446.335888] DR0: 006de000 DR1: 006de000 DR2: 
  
  [ 3446.335888] DR3:  DR6: 0ff0 DR7: 
  0602
  [ 3446.335888] Stack:
  [ 3446.335888]  88053e247798 88006eddc0b8 0016 
  
  [ 3446.335888]  88006ffd2068 88006ffdb008 0001 
  
  [ 3446.335888]  88006ffdb000  0003 
  0001
  [ 3446.335888] Call Trace:
  [ 3446.335888] __alloc_pages_nodemask (mm/page_alloc.c:2731)
  [ 3446.335888] ? __this_cpu_preempt_check (lib/smp_processor_id.c:63)
  [ 3446.335888] alloc_pages_vma (include/linux/mempolicy.h:76 
  mm/mempolicy.c:1998)
  [ 3446.335888] ? shmem_alloc_page (mm/shmem.c:881)
  [ 3446.335888] ? kvm_clock_read (arch/x86/include/asm/preempt.h:90 
  arch/x86/kernel/kvmclock.c:86)
  [ 3446.335888] shmem_alloc_page (mm/shmem.c:881)
  [ 3446.335888] ? __const_udelay (arch/x86/lib/delay.c:126)
  [ 3446.335888] ? __rcu_read_unlock (kernel/rcu/update.c:97)
  [ 3446.335888] ? find_get_entry (mm/filemap.c:979)
  [ 3446.335888] ? find_get_entry (mm/filemap.c:940)
  [ 3446.335888] ? find_lock_entry (mm/filemap.c:1024)
  [ 3446.335888] shmem_getpage_gfp (mm/shmem.c:1130)
  [ 3446.335888] ? sched_clock_local (kernel/sched/clock.c:214)
  [ 3446.335888] ? do_read_fault.isra.42 (mm/memory.c:3523)
  [ 3446.335888] shmem_fault (mm/shmem.c:1237)
  [ 3446.335888] ? do_read_fault.isra.42 (mm/memory.c:3523)
  [ 3446.335888] __do_fault (mm/memory.c:3344)
  [ 3446.335888] ? _raw_spin_unlock (arch/x86/include/asm/preempt.h:98 
  include/linux/spinlock_api_smp.h:152 kernel/locking/spinlock.c:183)
  [ 3446.335888] do_read_fault.isra.42 (mm/memory.c:3524)
  [ 3446.335888] ? get_parent_ip (kernel/sched/core.c:2485)
  [ 3446.335888] ? get_parent_ip (kernel/sched/core.c:2485)
  [ 3446.335888] __handle_mm_fault (mm/memory.c:3662 mm/memory.c:3823 
  mm/memory.c:3950)
  [ 3446.335888] ? __const_udelay (arch/x86/lib/delay.c:126)
  [ 3446.335888] ? __rcu_read_unlock (kernel/rcu/update.c:97)
  [ 3446.335888] handle_mm_fault (mm/memory.c:3973)
  [ 3446.335888] __get_user_pages (mm/memory.c:1863)
  [ 3446.335888] ? preempt_count_sub (kernel/sched/core.c:2541)
  [ 3446.335888] __mlock_vma_pages_range 

Re: [PATCH 2/2] mm/page_alloc: DEBUG_VM checks for free_list placement of CMA and RESERVE pages

2014-05-05 Thread Vlastimil Babka

On 05/05/2014 04:36 PM, Sasha Levin wrote:

On 05/02/2014 08:08 AM, Vlastimil Babka wrote:

On 04/30/2014 11:46 PM, Sasha Levin wrote:

On 04/03/2014 11:40 AM, Vlastimil Babka wrote:

For the MIGRATE_RESERVE pages, it is important they do not get misplaced
on free_list of other migratetype, otherwise the whole MIGRATE_RESERVE
pageblock might be changed to other migratetype in try_to_steal_freepages().
For MIGRATE_CMA, the pages also must not go to a different free_list, otherwise
they could get allocated as unmovable and result in CMA failure.

This is ensured by setting the freepage_migratetype appropriately when placing
pages on pcp lists, and using the information when releasing them back to
free_list. It is also assumed that CMA and RESERVE pageblocks are created only
in the init phase. This patch adds DEBUG_VM checks to catch any regressions
introduced for this invariant.

Cc: Yong-Taek Lee ytk@samsung.com
Cc: Bartlomiej Zolnierkiewicz b.zolnier...@samsung.com
Cc: Joonsoo Kim iamjoonsoo@lge.com
Cc: Mel Gorman mgor...@suse.de
Cc: Minchan Kim minc...@kernel.org
Cc: KOSAKI Motohiro kosaki.motoh...@jp.fujitsu.com
Cc: Marek Szyprowski m.szyprow...@samsung.com
Cc: Hugh Dickins hu...@google.com
Cc: Rik van Riel r...@redhat.com
Cc: Michal Nazarewicz min...@mina86.com
Signed-off-by: Vlastimil Babka vba...@suse.cz


Two issues with this patch.

First:

[ 3446.320082] kernel BUG at mm/page_alloc.c:1197!
[ 3446.320082] invalid opcode:  [#1] PREEMPT SMP DEBUG_PAGEALLOC
[ 3446.320082] Dumping ftrace buffer:
[ 3446.320082](ftrace buffer empty)
[ 3446.320082] Modules linked in:
[ 3446.320082] CPU: 1 PID: 8923 Comm: trinity-c42 Not tainted 
3.15.0-rc3-next-20140429-sasha-00015-g7c7e0a7-dirty #427
[ 3446.320082] task: 88053e208000 ti: 88053e246000 task.ti: 
88053e246000
[ 3446.320082] RIP: get_page_from_freelist (mm/page_alloc.c:1197 
mm/page_alloc.c:1548 mm/page_alloc.c:2036)
[ 3446.320082] RSP: 0018:88053e247778  EFLAGS: 00010002
[ 3446.320082] RAX: 0003 RBX: eaf4 RCX: 0008
[ 3446.320082] RDX: 0002 RSI: 0003 RDI: 00a0
[ 3446.320082] RBP: 88053e247868 R08: 0007 R09: 
[ 3446.320082] R10: 88006ffcef00 R11:  R12: 0014
[ 3446.335888] R13: ea000115ffe0 R14: ea000115ffe0 R15: 
[ 3446.335888] FS:  7f8c9f059700() GS:88006ec0() 
knlGS:
[ 3446.335888] CS:  0010 DS:  ES:  CR0: 8005003b
[ 3446.335888] CR2: 02cbc048 CR3: 00054cdb4000 CR4: 06a0
[ 3446.335888] DR0: 006de000 DR1: 006de000 DR2: 
[ 3446.335888] DR3:  DR6: 0ff0 DR7: 0602
[ 3446.335888] Stack:
[ 3446.335888]  88053e247798 88006eddc0b8 0016 

[ 3446.335888]  88006ffd2068 88006ffdb008 0001 

[ 3446.335888]  88006ffdb000  0003 
0001
[ 3446.335888] Call Trace:
[ 3446.335888] __alloc_pages_nodemask (mm/page_alloc.c:2731)
[ 3446.335888] ? __this_cpu_preempt_check (lib/smp_processor_id.c:63)
[ 3446.335888] alloc_pages_vma (include/linux/mempolicy.h:76 
mm/mempolicy.c:1998)
[ 3446.335888] ? shmem_alloc_page (mm/shmem.c:881)
[ 3446.335888] ? kvm_clock_read (arch/x86/include/asm/preempt.h:90 
arch/x86/kernel/kvmclock.c:86)
[ 3446.335888] shmem_alloc_page (mm/shmem.c:881)
[ 3446.335888] ? __const_udelay (arch/x86/lib/delay.c:126)
[ 3446.335888] ? __rcu_read_unlock (kernel/rcu/update.c:97)
[ 3446.335888] ? find_get_entry (mm/filemap.c:979)
[ 3446.335888] ? find_get_entry (mm/filemap.c:940)
[ 3446.335888] ? find_lock_entry (mm/filemap.c:1024)
[ 3446.335888] shmem_getpage_gfp (mm/shmem.c:1130)
[ 3446.335888] ? sched_clock_local (kernel/sched/clock.c:214)
[ 3446.335888] ? do_read_fault.isra.42 (mm/memory.c:3523)
[ 3446.335888] shmem_fault (mm/shmem.c:1237)
[ 3446.335888] ? do_read_fault.isra.42 (mm/memory.c:3523)
[ 3446.335888] __do_fault (mm/memory.c:3344)
[ 3446.335888] ? _raw_spin_unlock (arch/x86/include/asm/preempt.h:98 
include/linux/spinlock_api_smp.h:152 kernel/locking/spinlock.c:183)
[ 3446.335888] do_read_fault.isra.42 (mm/memory.c:3524)
[ 3446.335888] ? get_parent_ip (kernel/sched/core.c:2485)
[ 3446.335888] ? get_parent_ip (kernel/sched/core.c:2485)
[ 3446.335888] __handle_mm_fault (mm/memory.c:3662 mm/memory.c:3823 
mm/memory.c:3950)
[ 3446.335888] ? __const_udelay (arch/x86/lib/delay.c:126)
[ 3446.335888] ? __rcu_read_unlock (kernel/rcu/update.c:97)
[ 3446.335888] handle_mm_fault (mm/memory.c:3973)
[ 3446.335888] __get_user_pages (mm/memory.c:1863)
[ 3446.335888] ? preempt_count_sub (kernel/sched/core.c:2541)
[ 3446.335888] __mlock_vma_pages_range (mm/mlock.c:255)
[ 3446.335888] __mm_populate (mm/mlock.c:711)
[ 3446.335888] vm_mmap_pgoff (include/linux/mm.h:1841 mm/util.c:402)
[ 3446.335888] SyS_mmap_pgoff (mm/mmap.c:1378)

Re: [PATCH 2/2] mm/page_alloc: DEBUG_VM checks for free_list placement of CMA and RESERVE pages

2014-05-05 Thread Sasha Levin
On 05/05/2014 11:50 AM, Vlastimil Babka wrote:
 On 05/05/2014 04:36 PM, Sasha Levin wrote:
 On 05/02/2014 08:08 AM, Vlastimil Babka wrote:
 On 04/30/2014 11:46 PM, Sasha Levin wrote:
 On 04/03/2014 11:40 AM, Vlastimil Babka wrote:
 For the MIGRATE_RESERVE pages, it is important they do not get misplaced
 on free_list of other migratetype, otherwise the whole MIGRATE_RESERVE
 pageblock might be changed to other migratetype in 
 try_to_steal_freepages().
 For MIGRATE_CMA, the pages also must not go to a different free_list, 
 otherwise
 they could get allocated as unmovable and result in CMA failure.

 This is ensured by setting the freepage_migratetype appropriately when 
 placing
 pages on pcp lists, and using the information when releasing them back 
 to
 free_list. It is also assumed that CMA and RESERVE pageblocks are 
 created only
 in the init phase. This patch adds DEBUG_VM checks to catch any 
 regressions
 introduced for this invariant.

 Cc: Yong-Taek Lee ytk@samsung.com
 Cc: Bartlomiej Zolnierkiewicz b.zolnier...@samsung.com
 Cc: Joonsoo Kim iamjoonsoo@lge.com
 Cc: Mel Gorman mgor...@suse.de
 Cc: Minchan Kim minc...@kernel.org
 Cc: KOSAKI Motohiro kosaki.motoh...@jp.fujitsu.com
 Cc: Marek Szyprowski m.szyprow...@samsung.com
 Cc: Hugh Dickins hu...@google.com
 Cc: Rik van Riel r...@redhat.com
 Cc: Michal Nazarewicz min...@mina86.com
 Signed-off-by: Vlastimil Babka vba...@suse.cz

 Two issues with this patch.

 First:

 [ 3446.320082] kernel BUG at mm/page_alloc.c:1197!
 [ 3446.320082] invalid opcode:  [#1] PREEMPT SMP DEBUG_PAGEALLOC
 [ 3446.320082] Dumping ftrace buffer:
 [ 3446.320082](ftrace buffer empty)
 [ 3446.320082] Modules linked in:
 [ 3446.320082] CPU: 1 PID: 8923 Comm: trinity-c42 Not tainted 
 3.15.0-rc3-next-20140429-sasha-00015-g7c7e0a7-dirty #427
 [ 3446.320082] task: 88053e208000 ti: 88053e246000 task.ti: 
 88053e246000
 [ 3446.320082] RIP: get_page_from_freelist (mm/page_alloc.c:1197 
 mm/page_alloc.c:1548 mm/page_alloc.c:2036)
 [ 3446.320082] RSP: 0018:88053e247778  EFLAGS: 00010002
 [ 3446.320082] RAX: 0003 RBX: eaf4 RCX: 
 0008
 [ 3446.320082] RDX: 0002 RSI: 0003 RDI: 
 00a0
 [ 3446.320082] RBP: 88053e247868 R08: 0007 R09: 
 
 [ 3446.320082] R10: 88006ffcef00 R11:  R12: 
 0014
 [ 3446.335888] R13: ea000115ffe0 R14: ea000115ffe0 R15: 
 
 [ 3446.335888] FS:  7f8c9f059700() GS:88006ec0() 
 knlGS:
 [ 3446.335888] CS:  0010 DS:  ES:  CR0: 8005003b
 [ 3446.335888] CR2: 02cbc048 CR3: 00054cdb4000 CR4: 
 06a0
 [ 3446.335888] DR0: 006de000 DR1: 006de000 DR2: 
 
 [ 3446.335888] DR3:  DR6: 0ff0 DR7: 
 0602
 [ 3446.335888] Stack:
 [ 3446.335888]  88053e247798 88006eddc0b8 0016 
 
 [ 3446.335888]  88006ffd2068 88006ffdb008 0001 
 
 [ 3446.335888]  88006ffdb000  0003 
 0001
 [ 3446.335888] Call Trace:
 [ 3446.335888] __alloc_pages_nodemask (mm/page_alloc.c:2731)
 [ 3446.335888] ? __this_cpu_preempt_check (lib/smp_processor_id.c:63)
 [ 3446.335888] alloc_pages_vma (include/linux/mempolicy.h:76 
 mm/mempolicy.c:1998)
 [ 3446.335888] ? shmem_alloc_page (mm/shmem.c:881)
 [ 3446.335888] ? kvm_clock_read (arch/x86/include/asm/preempt.h:90 
 arch/x86/kernel/kvmclock.c:86)
 [ 3446.335888] shmem_alloc_page (mm/shmem.c:881)
 [ 3446.335888] ? __const_udelay (arch/x86/lib/delay.c:126)
 [ 3446.335888] ? __rcu_read_unlock (kernel/rcu/update.c:97)
 [ 3446.335888] ? find_get_entry (mm/filemap.c:979)
 [ 3446.335888] ? find_get_entry (mm/filemap.c:940)
 [ 3446.335888] ? find_lock_entry (mm/filemap.c:1024)
 [ 3446.335888] shmem_getpage_gfp (mm/shmem.c:1130)
 [ 3446.335888] ? sched_clock_local (kernel/sched/clock.c:214)
 [ 3446.335888] ? do_read_fault.isra.42 (mm/memory.c:3523)
 [ 3446.335888] shmem_fault (mm/shmem.c:1237)
 [ 3446.335888] ? do_read_fault.isra.42 (mm/memory.c:3523)
 [ 3446.335888] __do_fault (mm/memory.c:3344)
 [ 3446.335888] ? _raw_spin_unlock (arch/x86/include/asm/preempt.h:98 
 include/linux/spinlock_api_smp.h:152 kernel/locking/spinlock.c:183)
 [ 3446.335888] do_read_fault.isra.42 (mm/memory.c:3524)
 [ 3446.335888] ? get_parent_ip (kernel/sched/core.c:2485)
 [ 3446.335888] ? get_parent_ip (kernel/sched/core.c:2485)
 [ 3446.335888] __handle_mm_fault (mm/memory.c:3662 mm/memory.c:3823 
 mm/memory.c:3950)
 [ 3446.335888] ? __const_udelay (arch/x86/lib/delay.c:126)
 [ 3446.335888] ? __rcu_read_unlock (kernel/rcu/update.c:97)
 [ 3446.335888] handle_mm_fault (mm/memory.c:3973)
 [ 3446.335888] __get_user_pages (mm/memory.c:1863)
 [ 3446.335888] ? preempt_count_sub (kernel/sched/core.c:2541)
 [ 3446.335888] __mlock_vma_pages_range (mm/mlock.c:255)
 [ 

Re: [PATCH 2/2] mm/page_alloc: DEBUG_VM checks for free_list placement of CMA and RESERVE pages

2014-05-02 Thread Vlastimil Babka
On 04/30/2014 11:46 PM, Sasha Levin wrote:
> On 04/03/2014 11:40 AM, Vlastimil Babka wrote:
>> For the MIGRATE_RESERVE pages, it is important they do not get misplaced
>> on free_list of other migratetype, otherwise the whole MIGRATE_RESERVE
>> pageblock might be changed to other migratetype in try_to_steal_freepages().
>> For MIGRATE_CMA, the pages also must not go to a different free_list, 
>> otherwise
>> they could get allocated as unmovable and result in CMA failure.
>>
>> This is ensured by setting the freepage_migratetype appropriately when 
>> placing
>> pages on pcp lists, and using the information when releasing them back to
>> free_list. It is also assumed that CMA and RESERVE pageblocks are created 
>> only
>> in the init phase. This patch adds DEBUG_VM checks to catch any regressions
>> introduced for this invariant.
>>
>> Cc: Yong-Taek Lee 
>> Cc: Bartlomiej Zolnierkiewicz 
>> Cc: Joonsoo Kim 
>> Cc: Mel Gorman 
>> Cc: Minchan Kim 
>> Cc: KOSAKI Motohiro 
>> Cc: Marek Szyprowski 
>> Cc: Hugh Dickins 
>> Cc: Rik van Riel 
>> Cc: Michal Nazarewicz 
>> Signed-off-by: Vlastimil Babka 
> 
> Two issues with this patch.
> 
> First:
> 
> [ 3446.320082] kernel BUG at mm/page_alloc.c:1197!
> [ 3446.320082] invalid opcode:  [#1] PREEMPT SMP DEBUG_PAGEALLOC
> [ 3446.320082] Dumping ftrace buffer:
> [ 3446.320082](ftrace buffer empty)
> [ 3446.320082] Modules linked in:
> [ 3446.320082] CPU: 1 PID: 8923 Comm: trinity-c42 Not tainted 
> 3.15.0-rc3-next-20140429-sasha-00015-g7c7e0a7-dirty #427
> [ 3446.320082] task: 88053e208000 ti: 88053e246000 task.ti: 
> 88053e246000
> [ 3446.320082] RIP: get_page_from_freelist (mm/page_alloc.c:1197 
> mm/page_alloc.c:1548 mm/page_alloc.c:2036)
> [ 3446.320082] RSP: 0018:88053e247778  EFLAGS: 00010002
> [ 3446.320082] RAX: 0003 RBX: eaf4 RCX: 
> 0008
> [ 3446.320082] RDX: 0002 RSI: 0003 RDI: 
> 00a0
> [ 3446.320082] RBP: 88053e247868 R08: 0007 R09: 
> 
> [ 3446.320082] R10: 88006ffcef00 R11:  R12: 
> 0014
> [ 3446.335888] R13: ea000115ffe0 R14: ea000115ffe0 R15: 
> 
> [ 3446.335888] FS:  7f8c9f059700() GS:88006ec0() 
> knlGS:
> [ 3446.335888] CS:  0010 DS:  ES:  CR0: 8005003b
> [ 3446.335888] CR2: 02cbc048 CR3: 00054cdb4000 CR4: 
> 06a0
> [ 3446.335888] DR0: 006de000 DR1: 006de000 DR2: 
> 
> [ 3446.335888] DR3:  DR6: 0ff0 DR7: 
> 0602
> [ 3446.335888] Stack:
> [ 3446.335888]  88053e247798 88006eddc0b8 0016 
> 
> [ 3446.335888]  88006ffd2068 88006ffdb008 0001 
> 
> [ 3446.335888]  88006ffdb000  0003 
> 0001
> [ 3446.335888] Call Trace:
> [ 3446.335888] __alloc_pages_nodemask (mm/page_alloc.c:2731)
> [ 3446.335888] ? __this_cpu_preempt_check (lib/smp_processor_id.c:63)
> [ 3446.335888] alloc_pages_vma (include/linux/mempolicy.h:76 
> mm/mempolicy.c:1998)
> [ 3446.335888] ? shmem_alloc_page (mm/shmem.c:881)
> [ 3446.335888] ? kvm_clock_read (arch/x86/include/asm/preempt.h:90 
> arch/x86/kernel/kvmclock.c:86)
> [ 3446.335888] shmem_alloc_page (mm/shmem.c:881)
> [ 3446.335888] ? __const_udelay (arch/x86/lib/delay.c:126)
> [ 3446.335888] ? __rcu_read_unlock (kernel/rcu/update.c:97)
> [ 3446.335888] ? find_get_entry (mm/filemap.c:979)
> [ 3446.335888] ? find_get_entry (mm/filemap.c:940)
> [ 3446.335888] ? find_lock_entry (mm/filemap.c:1024)
> [ 3446.335888] shmem_getpage_gfp (mm/shmem.c:1130)
> [ 3446.335888] ? sched_clock_local (kernel/sched/clock.c:214)
> [ 3446.335888] ? do_read_fault.isra.42 (mm/memory.c:3523)
> [ 3446.335888] shmem_fault (mm/shmem.c:1237)
> [ 3446.335888] ? do_read_fault.isra.42 (mm/memory.c:3523)
> [ 3446.335888] __do_fault (mm/memory.c:3344)
> [ 3446.335888] ? _raw_spin_unlock (arch/x86/include/asm/preempt.h:98 
> include/linux/spinlock_api_smp.h:152 kernel/locking/spinlock.c:183)
> [ 3446.335888] do_read_fault.isra.42 (mm/memory.c:3524)
> [ 3446.335888] ? get_parent_ip (kernel/sched/core.c:2485)
> [ 3446.335888] ? get_parent_ip (kernel/sched/core.c:2485)
> [ 3446.335888] __handle_mm_fault (mm/memory.c:3662 mm/memory.c:3823 
> mm/memory.c:3950)
> [ 3446.335888] ? __const_udelay (arch/x86/lib/delay.c:126)
> [ 3446.335888] ? __rcu_read_unlock (kernel/rcu/update.c:97)
> [ 3446.335888] handle_mm_fault (mm/memory.c:3973)
> [ 3446.335888] __get_user_pages (mm/memory.c:1863)
> [ 3446.335888] ? preempt_count_sub (kernel/sched/core.c:2541)
> [ 3446.335888] __mlock_vma_pages_range (mm/mlock.c:255)
> [ 3446.335888] __mm_populate (mm/mlock.c:711)
> [ 3446.335888] vm_mmap_pgoff (include/linux/mm.h:1841 mm/util.c:402)
> [ 3446.335888] SyS_mmap_pgoff (mm/mmap.c:1378)
> [ 3446.335888] ? syscall_trace_enter 

Re: [PATCH 2/2] mm/page_alloc: DEBUG_VM checks for free_list placement of CMA and RESERVE pages

2014-05-02 Thread Vlastimil Babka
On 04/30/2014 11:46 PM, Sasha Levin wrote:
 On 04/03/2014 11:40 AM, Vlastimil Babka wrote:
 For the MIGRATE_RESERVE pages, it is important they do not get misplaced
 on free_list of other migratetype, otherwise the whole MIGRATE_RESERVE
 pageblock might be changed to other migratetype in try_to_steal_freepages().
 For MIGRATE_CMA, the pages also must not go to a different free_list, 
 otherwise
 they could get allocated as unmovable and result in CMA failure.

 This is ensured by setting the freepage_migratetype appropriately when 
 placing
 pages on pcp lists, and using the information when releasing them back to
 free_list. It is also assumed that CMA and RESERVE pageblocks are created 
 only
 in the init phase. This patch adds DEBUG_VM checks to catch any regressions
 introduced for this invariant.

 Cc: Yong-Taek Lee ytk@samsung.com
 Cc: Bartlomiej Zolnierkiewicz b.zolnier...@samsung.com
 Cc: Joonsoo Kim iamjoonsoo@lge.com
 Cc: Mel Gorman mgor...@suse.de
 Cc: Minchan Kim minc...@kernel.org
 Cc: KOSAKI Motohiro kosaki.motoh...@jp.fujitsu.com
 Cc: Marek Szyprowski m.szyprow...@samsung.com
 Cc: Hugh Dickins hu...@google.com
 Cc: Rik van Riel r...@redhat.com
 Cc: Michal Nazarewicz min...@mina86.com
 Signed-off-by: Vlastimil Babka vba...@suse.cz
 
 Two issues with this patch.
 
 First:
 
 [ 3446.320082] kernel BUG at mm/page_alloc.c:1197!
 [ 3446.320082] invalid opcode:  [#1] PREEMPT SMP DEBUG_PAGEALLOC
 [ 3446.320082] Dumping ftrace buffer:
 [ 3446.320082](ftrace buffer empty)
 [ 3446.320082] Modules linked in:
 [ 3446.320082] CPU: 1 PID: 8923 Comm: trinity-c42 Not tainted 
 3.15.0-rc3-next-20140429-sasha-00015-g7c7e0a7-dirty #427
 [ 3446.320082] task: 88053e208000 ti: 88053e246000 task.ti: 
 88053e246000
 [ 3446.320082] RIP: get_page_from_freelist (mm/page_alloc.c:1197 
 mm/page_alloc.c:1548 mm/page_alloc.c:2036)
 [ 3446.320082] RSP: 0018:88053e247778  EFLAGS: 00010002
 [ 3446.320082] RAX: 0003 RBX: eaf4 RCX: 
 0008
 [ 3446.320082] RDX: 0002 RSI: 0003 RDI: 
 00a0
 [ 3446.320082] RBP: 88053e247868 R08: 0007 R09: 
 
 [ 3446.320082] R10: 88006ffcef00 R11:  R12: 
 0014
 [ 3446.335888] R13: ea000115ffe0 R14: ea000115ffe0 R15: 
 
 [ 3446.335888] FS:  7f8c9f059700() GS:88006ec0() 
 knlGS:
 [ 3446.335888] CS:  0010 DS:  ES:  CR0: 8005003b
 [ 3446.335888] CR2: 02cbc048 CR3: 00054cdb4000 CR4: 
 06a0
 [ 3446.335888] DR0: 006de000 DR1: 006de000 DR2: 
 
 [ 3446.335888] DR3:  DR6: 0ff0 DR7: 
 0602
 [ 3446.335888] Stack:
 [ 3446.335888]  88053e247798 88006eddc0b8 0016 
 
 [ 3446.335888]  88006ffd2068 88006ffdb008 0001 
 
 [ 3446.335888]  88006ffdb000  0003 
 0001
 [ 3446.335888] Call Trace:
 [ 3446.335888] __alloc_pages_nodemask (mm/page_alloc.c:2731)
 [ 3446.335888] ? __this_cpu_preempt_check (lib/smp_processor_id.c:63)
 [ 3446.335888] alloc_pages_vma (include/linux/mempolicy.h:76 
 mm/mempolicy.c:1998)
 [ 3446.335888] ? shmem_alloc_page (mm/shmem.c:881)
 [ 3446.335888] ? kvm_clock_read (arch/x86/include/asm/preempt.h:90 
 arch/x86/kernel/kvmclock.c:86)
 [ 3446.335888] shmem_alloc_page (mm/shmem.c:881)
 [ 3446.335888] ? __const_udelay (arch/x86/lib/delay.c:126)
 [ 3446.335888] ? __rcu_read_unlock (kernel/rcu/update.c:97)
 [ 3446.335888] ? find_get_entry (mm/filemap.c:979)
 [ 3446.335888] ? find_get_entry (mm/filemap.c:940)
 [ 3446.335888] ? find_lock_entry (mm/filemap.c:1024)
 [ 3446.335888] shmem_getpage_gfp (mm/shmem.c:1130)
 [ 3446.335888] ? sched_clock_local (kernel/sched/clock.c:214)
 [ 3446.335888] ? do_read_fault.isra.42 (mm/memory.c:3523)
 [ 3446.335888] shmem_fault (mm/shmem.c:1237)
 [ 3446.335888] ? do_read_fault.isra.42 (mm/memory.c:3523)
 [ 3446.335888] __do_fault (mm/memory.c:3344)
 [ 3446.335888] ? _raw_spin_unlock (arch/x86/include/asm/preempt.h:98 
 include/linux/spinlock_api_smp.h:152 kernel/locking/spinlock.c:183)
 [ 3446.335888] do_read_fault.isra.42 (mm/memory.c:3524)
 [ 3446.335888] ? get_parent_ip (kernel/sched/core.c:2485)
 [ 3446.335888] ? get_parent_ip (kernel/sched/core.c:2485)
 [ 3446.335888] __handle_mm_fault (mm/memory.c:3662 mm/memory.c:3823 
 mm/memory.c:3950)
 [ 3446.335888] ? __const_udelay (arch/x86/lib/delay.c:126)
 [ 3446.335888] ? __rcu_read_unlock (kernel/rcu/update.c:97)
 [ 3446.335888] handle_mm_fault (mm/memory.c:3973)
 [ 3446.335888] __get_user_pages (mm/memory.c:1863)
 [ 3446.335888] ? preempt_count_sub (kernel/sched/core.c:2541)
 [ 3446.335888] __mlock_vma_pages_range (mm/mlock.c:255)
 [ 3446.335888] __mm_populate (mm/mlock.c:711)
 [ 3446.335888] vm_mmap_pgoff (include/linux/mm.h:1841 mm/util.c:402)
 [ 3446.335888] 

Re: [PATCH 2/2] mm/page_alloc: DEBUG_VM checks for free_list placement of CMA and RESERVE pages

2014-04-30 Thread Sasha Levin
On 04/03/2014 11:40 AM, Vlastimil Babka wrote:
> For the MIGRATE_RESERVE pages, it is important they do not get misplaced
> on free_list of other migratetype, otherwise the whole MIGRATE_RESERVE
> pageblock might be changed to other migratetype in try_to_steal_freepages().
> For MIGRATE_CMA, the pages also must not go to a different free_list, 
> otherwise
> they could get allocated as unmovable and result in CMA failure.
> 
> This is ensured by setting the freepage_migratetype appropriately when placing
> pages on pcp lists, and using the information when releasing them back to
> free_list. It is also assumed that CMA and RESERVE pageblocks are created only
> in the init phase. This patch adds DEBUG_VM checks to catch any regressions
> introduced for this invariant.
> 
> Cc: Yong-Taek Lee 
> Cc: Bartlomiej Zolnierkiewicz 
> Cc: Joonsoo Kim 
> Cc: Mel Gorman 
> Cc: Minchan Kim 
> Cc: KOSAKI Motohiro 
> Cc: Marek Szyprowski 
> Cc: Hugh Dickins 
> Cc: Rik van Riel 
> Cc: Michal Nazarewicz 
> Signed-off-by: Vlastimil Babka 

Two issues with this patch.

First:

[ 3446.320082] kernel BUG at mm/page_alloc.c:1197!
[ 3446.320082] invalid opcode:  [#1] PREEMPT SMP DEBUG_PAGEALLOC
[ 3446.320082] Dumping ftrace buffer:
[ 3446.320082](ftrace buffer empty)
[ 3446.320082] Modules linked in:
[ 3446.320082] CPU: 1 PID: 8923 Comm: trinity-c42 Not tainted 
3.15.0-rc3-next-20140429-sasha-00015-g7c7e0a7-dirty #427
[ 3446.320082] task: 88053e208000 ti: 88053e246000 task.ti: 
88053e246000
[ 3446.320082] RIP: get_page_from_freelist (mm/page_alloc.c:1197 
mm/page_alloc.c:1548 mm/page_alloc.c:2036)
[ 3446.320082] RSP: 0018:88053e247778  EFLAGS: 00010002
[ 3446.320082] RAX: 0003 RBX: eaf4 RCX: 0008
[ 3446.320082] RDX: 0002 RSI: 0003 RDI: 00a0
[ 3446.320082] RBP: 88053e247868 R08: 0007 R09: 
[ 3446.320082] R10: 88006ffcef00 R11:  R12: 0014
[ 3446.335888] R13: ea000115ffe0 R14: ea000115ffe0 R15: 
[ 3446.335888] FS:  7f8c9f059700() GS:88006ec0() 
knlGS:
[ 3446.335888] CS:  0010 DS:  ES:  CR0: 8005003b
[ 3446.335888] CR2: 02cbc048 CR3: 00054cdb4000 CR4: 06a0
[ 3446.335888] DR0: 006de000 DR1: 006de000 DR2: 
[ 3446.335888] DR3:  DR6: 0ff0 DR7: 0602
[ 3446.335888] Stack:
[ 3446.335888]  88053e247798 88006eddc0b8 0016 

[ 3446.335888]  88006ffd2068 88006ffdb008 0001 

[ 3446.335888]  88006ffdb000  0003 
0001
[ 3446.335888] Call Trace:
[ 3446.335888] __alloc_pages_nodemask (mm/page_alloc.c:2731)
[ 3446.335888] ? __this_cpu_preempt_check (lib/smp_processor_id.c:63)
[ 3446.335888] alloc_pages_vma (include/linux/mempolicy.h:76 
mm/mempolicy.c:1998)
[ 3446.335888] ? shmem_alloc_page (mm/shmem.c:881)
[ 3446.335888] ? kvm_clock_read (arch/x86/include/asm/preempt.h:90 
arch/x86/kernel/kvmclock.c:86)
[ 3446.335888] shmem_alloc_page (mm/shmem.c:881)
[ 3446.335888] ? __const_udelay (arch/x86/lib/delay.c:126)
[ 3446.335888] ? __rcu_read_unlock (kernel/rcu/update.c:97)
[ 3446.335888] ? find_get_entry (mm/filemap.c:979)
[ 3446.335888] ? find_get_entry (mm/filemap.c:940)
[ 3446.335888] ? find_lock_entry (mm/filemap.c:1024)
[ 3446.335888] shmem_getpage_gfp (mm/shmem.c:1130)
[ 3446.335888] ? sched_clock_local (kernel/sched/clock.c:214)
[ 3446.335888] ? do_read_fault.isra.42 (mm/memory.c:3523)
[ 3446.335888] shmem_fault (mm/shmem.c:1237)
[ 3446.335888] ? do_read_fault.isra.42 (mm/memory.c:3523)
[ 3446.335888] __do_fault (mm/memory.c:3344)
[ 3446.335888] ? _raw_spin_unlock (arch/x86/include/asm/preempt.h:98 
include/linux/spinlock_api_smp.h:152 kernel/locking/spinlock.c:183)
[ 3446.335888] do_read_fault.isra.42 (mm/memory.c:3524)
[ 3446.335888] ? get_parent_ip (kernel/sched/core.c:2485)
[ 3446.335888] ? get_parent_ip (kernel/sched/core.c:2485)
[ 3446.335888] __handle_mm_fault (mm/memory.c:3662 mm/memory.c:3823 
mm/memory.c:3950)
[ 3446.335888] ? __const_udelay (arch/x86/lib/delay.c:126)
[ 3446.335888] ? __rcu_read_unlock (kernel/rcu/update.c:97)
[ 3446.335888] handle_mm_fault (mm/memory.c:3973)
[ 3446.335888] __get_user_pages (mm/memory.c:1863)
[ 3446.335888] ? preempt_count_sub (kernel/sched/core.c:2541)
[ 3446.335888] __mlock_vma_pages_range (mm/mlock.c:255)
[ 3446.335888] __mm_populate (mm/mlock.c:711)
[ 3446.335888] vm_mmap_pgoff (include/linux/mm.h:1841 mm/util.c:402)
[ 3446.335888] SyS_mmap_pgoff (mm/mmap.c:1378)
[ 3446.335888] ? syscall_trace_enter (include/linux/context_tracking.h:27 
arch/x86/kernel/ptrace.c:1461)
[ 3446.335888] ia32_do_call (arch/x86/ia32/ia32entry.S:430)
[ 3446.335888] Code: 00 66 0f 1f 44 00 00 ba 02 00 00 00 31 f6 48 89 c7 e8 c1 
c3 ff ff 48 8b 53 10 83 f8 03 74 08 83 f8 04 75 13 0f 1f 

Re: [PATCH 2/2] mm/page_alloc: DEBUG_VM checks for free_list placement of CMA and RESERVE pages

2014-04-30 Thread Sasha Levin
On 04/03/2014 11:40 AM, Vlastimil Babka wrote:
 For the MIGRATE_RESERVE pages, it is important they do not get misplaced
 on free_list of other migratetype, otherwise the whole MIGRATE_RESERVE
 pageblock might be changed to other migratetype in try_to_steal_freepages().
 For MIGRATE_CMA, the pages also must not go to a different free_list, 
 otherwise
 they could get allocated as unmovable and result in CMA failure.
 
 This is ensured by setting the freepage_migratetype appropriately when placing
 pages on pcp lists, and using the information when releasing them back to
 free_list. It is also assumed that CMA and RESERVE pageblocks are created only
 in the init phase. This patch adds DEBUG_VM checks to catch any regressions
 introduced for this invariant.
 
 Cc: Yong-Taek Lee ytk@samsung.com
 Cc: Bartlomiej Zolnierkiewicz b.zolnier...@samsung.com
 Cc: Joonsoo Kim iamjoonsoo@lge.com
 Cc: Mel Gorman mgor...@suse.de
 Cc: Minchan Kim minc...@kernel.org
 Cc: KOSAKI Motohiro kosaki.motoh...@jp.fujitsu.com
 Cc: Marek Szyprowski m.szyprow...@samsung.com
 Cc: Hugh Dickins hu...@google.com
 Cc: Rik van Riel r...@redhat.com
 Cc: Michal Nazarewicz min...@mina86.com
 Signed-off-by: Vlastimil Babka vba...@suse.cz

Two issues with this patch.

First:

[ 3446.320082] kernel BUG at mm/page_alloc.c:1197!
[ 3446.320082] invalid opcode:  [#1] PREEMPT SMP DEBUG_PAGEALLOC
[ 3446.320082] Dumping ftrace buffer:
[ 3446.320082](ftrace buffer empty)
[ 3446.320082] Modules linked in:
[ 3446.320082] CPU: 1 PID: 8923 Comm: trinity-c42 Not tainted 
3.15.0-rc3-next-20140429-sasha-00015-g7c7e0a7-dirty #427
[ 3446.320082] task: 88053e208000 ti: 88053e246000 task.ti: 
88053e246000
[ 3446.320082] RIP: get_page_from_freelist (mm/page_alloc.c:1197 
mm/page_alloc.c:1548 mm/page_alloc.c:2036)
[ 3446.320082] RSP: 0018:88053e247778  EFLAGS: 00010002
[ 3446.320082] RAX: 0003 RBX: eaf4 RCX: 0008
[ 3446.320082] RDX: 0002 RSI: 0003 RDI: 00a0
[ 3446.320082] RBP: 88053e247868 R08: 0007 R09: 
[ 3446.320082] R10: 88006ffcef00 R11:  R12: 0014
[ 3446.335888] R13: ea000115ffe0 R14: ea000115ffe0 R15: 
[ 3446.335888] FS:  7f8c9f059700() GS:88006ec0() 
knlGS:
[ 3446.335888] CS:  0010 DS:  ES:  CR0: 8005003b
[ 3446.335888] CR2: 02cbc048 CR3: 00054cdb4000 CR4: 06a0
[ 3446.335888] DR0: 006de000 DR1: 006de000 DR2: 
[ 3446.335888] DR3:  DR6: 0ff0 DR7: 0602
[ 3446.335888] Stack:
[ 3446.335888]  88053e247798 88006eddc0b8 0016 

[ 3446.335888]  88006ffd2068 88006ffdb008 0001 

[ 3446.335888]  88006ffdb000  0003 
0001
[ 3446.335888] Call Trace:
[ 3446.335888] __alloc_pages_nodemask (mm/page_alloc.c:2731)
[ 3446.335888] ? __this_cpu_preempt_check (lib/smp_processor_id.c:63)
[ 3446.335888] alloc_pages_vma (include/linux/mempolicy.h:76 
mm/mempolicy.c:1998)
[ 3446.335888] ? shmem_alloc_page (mm/shmem.c:881)
[ 3446.335888] ? kvm_clock_read (arch/x86/include/asm/preempt.h:90 
arch/x86/kernel/kvmclock.c:86)
[ 3446.335888] shmem_alloc_page (mm/shmem.c:881)
[ 3446.335888] ? __const_udelay (arch/x86/lib/delay.c:126)
[ 3446.335888] ? __rcu_read_unlock (kernel/rcu/update.c:97)
[ 3446.335888] ? find_get_entry (mm/filemap.c:979)
[ 3446.335888] ? find_get_entry (mm/filemap.c:940)
[ 3446.335888] ? find_lock_entry (mm/filemap.c:1024)
[ 3446.335888] shmem_getpage_gfp (mm/shmem.c:1130)
[ 3446.335888] ? sched_clock_local (kernel/sched/clock.c:214)
[ 3446.335888] ? do_read_fault.isra.42 (mm/memory.c:3523)
[ 3446.335888] shmem_fault (mm/shmem.c:1237)
[ 3446.335888] ? do_read_fault.isra.42 (mm/memory.c:3523)
[ 3446.335888] __do_fault (mm/memory.c:3344)
[ 3446.335888] ? _raw_spin_unlock (arch/x86/include/asm/preempt.h:98 
include/linux/spinlock_api_smp.h:152 kernel/locking/spinlock.c:183)
[ 3446.335888] do_read_fault.isra.42 (mm/memory.c:3524)
[ 3446.335888] ? get_parent_ip (kernel/sched/core.c:2485)
[ 3446.335888] ? get_parent_ip (kernel/sched/core.c:2485)
[ 3446.335888] __handle_mm_fault (mm/memory.c:3662 mm/memory.c:3823 
mm/memory.c:3950)
[ 3446.335888] ? __const_udelay (arch/x86/lib/delay.c:126)
[ 3446.335888] ? __rcu_read_unlock (kernel/rcu/update.c:97)
[ 3446.335888] handle_mm_fault (mm/memory.c:3973)
[ 3446.335888] __get_user_pages (mm/memory.c:1863)
[ 3446.335888] ? preempt_count_sub (kernel/sched/core.c:2541)
[ 3446.335888] __mlock_vma_pages_range (mm/mlock.c:255)
[ 3446.335888] __mm_populate (mm/mlock.c:711)
[ 3446.335888] vm_mmap_pgoff (include/linux/mm.h:1841 mm/util.c:402)
[ 3446.335888] SyS_mmap_pgoff (mm/mmap.c:1378)
[ 3446.335888] ? syscall_trace_enter (include/linux/context_tracking.h:27 
arch/x86/kernel/ptrace.c:1461)
[ 

Re: [PATCH 2/2] mm/page_alloc: DEBUG_VM checks for free_list placement of CMA and RESERVE pages

2014-04-15 Thread Joonsoo Kim
On Thu, Apr 03, 2014 at 05:40:18PM +0200, Vlastimil Babka wrote:
> For the MIGRATE_RESERVE pages, it is important they do not get misplaced
> on free_list of other migratetype, otherwise the whole MIGRATE_RESERVE
> pageblock might be changed to other migratetype in try_to_steal_freepages().
> For MIGRATE_CMA, the pages also must not go to a different free_list, 
> otherwise
> they could get allocated as unmovable and result in CMA failure.
> 
> This is ensured by setting the freepage_migratetype appropriately when placing
> pages on pcp lists, and using the information when releasing them back to
> free_list. It is also assumed that CMA and RESERVE pageblocks are created only
> in the init phase. This patch adds DEBUG_VM checks to catch any regressions
> introduced for this invariant.

Hello, Vlastimil.

Idea looks good to me.

> 
> Cc: Yong-Taek Lee 
> Cc: Bartlomiej Zolnierkiewicz 
> Cc: Joonsoo Kim 
> Cc: Mel Gorman 
> Cc: Minchan Kim 
> Cc: KOSAKI Motohiro 
> Cc: Marek Szyprowski 
> Cc: Hugh Dickins 
> Cc: Rik van Riel 
> Cc: Michal Nazarewicz 
> Signed-off-by: Vlastimil Babka 

Acked-by: Joonsoo Kim 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/2] mm/page_alloc: DEBUG_VM checks for free_list placement of CMA and RESERVE pages

2014-04-15 Thread Joonsoo Kim
On Thu, Apr 03, 2014 at 05:40:18PM +0200, Vlastimil Babka wrote:
 For the MIGRATE_RESERVE pages, it is important they do not get misplaced
 on free_list of other migratetype, otherwise the whole MIGRATE_RESERVE
 pageblock might be changed to other migratetype in try_to_steal_freepages().
 For MIGRATE_CMA, the pages also must not go to a different free_list, 
 otherwise
 they could get allocated as unmovable and result in CMA failure.
 
 This is ensured by setting the freepage_migratetype appropriately when placing
 pages on pcp lists, and using the information when releasing them back to
 free_list. It is also assumed that CMA and RESERVE pageblocks are created only
 in the init phase. This patch adds DEBUG_VM checks to catch any regressions
 introduced for this invariant.

Hello, Vlastimil.

Idea looks good to me.

 
 Cc: Yong-Taek Lee ytk@samsung.com
 Cc: Bartlomiej Zolnierkiewicz b.zolnier...@samsung.com
 Cc: Joonsoo Kim iamjoonsoo@lge.com
 Cc: Mel Gorman mgor...@suse.de
 Cc: Minchan Kim minc...@kernel.org
 Cc: KOSAKI Motohiro kosaki.motoh...@jp.fujitsu.com
 Cc: Marek Szyprowski m.szyprow...@samsung.com
 Cc: Hugh Dickins hu...@google.com
 Cc: Rik van Riel r...@redhat.com
 Cc: Michal Nazarewicz min...@mina86.com
 Signed-off-by: Vlastimil Babka vba...@suse.cz

Acked-by: Joonsoo Kim iamjoonsoo@lge.com
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/