linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* page order 0 allocation fail but free pages are enough
@ 2016-05-23  6:47 yoma sophian
  2016-05-23 14:47 ` Michal Hocko
  0 siblings, 1 reply; 9+ messages in thread
From: yoma sophian @ 2016-05-23  6:47 UTC (permalink / raw)
  To: linux-mm

[-- Attachment #1: Type: text/plain, Size: 7143 bytes --]

hi all:
I got something wired that
1. in softirq, there is a page order 0 allocation request
2. Normal/High zone are free enough for order 0 page.
3. but somehow kernel return order 0 allocation fail.

My kernel version is 3.10 and below is kernel log:
from memory info,
the usd of pcb in Norma/High is > 0
[ 8606.703526] Mem-info:
[ 8606.703530] Normal per-cpu:
[ 8606.703535] CPU    0: hi:   90, btch:  15 usd:  10
[ 8606.703540] CPU    1: hi:   90, btch:  15 usd:  47
[ 8606.703543] HighMem per-cpu:
[ 8606.703547] CPU    0: hi:   18, btch:   3 usd:   2
[ 8606.703551] CPU    1: hi:   18, btch:   3 usd:   2

the free memory size of Normal is
[ 8606.703590] Normal free:60684kB

the free memory size of Highmem is
[ 8606.703625] HighMem free:300kB

I trace mm/page_alloc.c the page order 0 allocation will follow below path.
a. if pcp->count !=0, the page will directly get from pre-allocated list.
b. if pcp->count ==0, the page will allocated from budy system if it
is still get free pages enough.

in my case, both a) and b) the page allocation should be ok.
But why kernel still reject the order 0 page allocation?
appreciate your kind help in advance,

    get_page_from_freelist --> buffered_rmqueue -->
               if (likely(order == 0)) {
                struct per_cpu_pages *pcp;
                struct list_head *list;

                local_irq_save(flags);
                pcp = &this_cpu_ptr(zone->pageset)->pcp;
                list = &pcp->lists[migratetype];
                if (list_empty(list)) {
                        pcp->count += rmqueue_bulk(zone, 0,
                                        pcp->batch, list,
                                        migratetype, cold);
                        if (unlikely(list_empty(list)))
                                goto failed;
                }
                if (cold)
                        page = list_entry(list->prev, struct page, lru);
                else
                        page = list_entry(list->next, struct page, lru);
                list_del(&page->lru);
                pcp->count--;


[ 8606.701343] CompositorTileW: page allocation failure: order:0, mode:0x20
[ 8606.701356] CPU: 0 PID: 26064 Comm: CompositorTileW Tainted: G
     O 3.10.0+ #2
[ 8606.701365] Backtrace:
[ 8606.701390] [<c00129f8>] (dump_backtrace+0x0/0x114) from
[<c0012c68>] (show_stack+0x20/0x24)
[ 8606.701403]  r6:c9bee000 r5:00000000 r4:00000020 r3:271ae71c
[ 8606.701419] [<c0012c48>] (show_stack+0x0/0x24) from [<c056d2ec>]
(dump_stack+0x24/0x28)
[ 8606.701434] [<c056d2c8>] (dump_stack+0x0/0x28) from [<c010c668>]
(warn_alloc_failed+0xec/0x128)
[ 8606.701447] [<c010c57c>] (warn_alloc_failed+0x0/0x128) from
[<c010fd1c>] (__alloc_pages_nodemask+0x70c/0x940)
[ 8606.701456]  r3:00000000 r2:00000000
[ 8606.701466]  r7:c07fe240 r6:00000000 r5:00000000 r4:00000020
[ 8606.701476] [<c010f610>] (__alloc_pages_nodemask+0x0/0x940) from
[<c043ebc4>] (__netdev_alloc_frag+0x1cc/0x1e8)
[ 8606.701487] [<c043e9f8>] (__netdev_alloc_frag+0x0/0x1e8) from
[<c044128c>] (__netdev_alloc_skb+0x84/0xe0)
[ 8606.701943] [<c0441208>] (__netdev_alloc_skb+0x0/0xe0) from
[<bfbf834c>] (_rtw_skb_alloc+0x3c/0x40 [8812au])
[ 8606.701958]  r6:0000060e r5:d4af3160 r4:0000064a r3:00000100
[ 8606.702374] [<bfbf8310>] (_rtw_skb_alloc+0x0/0x40 [8812au]) from
[<bfc0bc80>] (rtw_os_alloc_recvframe+0x6c/0xfc [8812au])
[ 8606.702795] [<bfc0bc14>] (rtw_os_alloc_recvframe+0x0/0xfc [8812au])
from [<bfc4eb64>] (recvbuf2recvframe+0x36c/0x388 [8812au])
[ 8606.703193] [<bfc4e7f8>] (recvbuf2recvframe+0x0/0x388 [8812au])
from [<bfbff438>] (usb_recv_tasklet+0x6c/0x94 [8812au])
[ 8606.703385] [<bfbff3cc>] (usb_recv_tasklet+0x0/0x94 [8812au]) from
[<c002de24>] (tasklet_action+0xa8/0x178)
[ 8606.703398]  r7:c07b25ec r6:00000000 r5:d4809b5c r4:d4809b58
[ 8606.703407] [<c002dd7c>] (tasklet_action+0x0/0x178) from
[<c002cdd0>] (__do_softirq+0x164/0x344)
[ 8606.703423]  r8:00000008 r7:00000018 r6:c07b8098 r5:c9bee000 r4:00000006
[ 8606.703423] r3:c002dd7c
[ 8606.703431] [<c002cc6c>] (__do_softirq+0x0/0x344) from [<c002d530>]
(irq_exit+0xbc/0xf0)
[ 8606.703444] [<c002d474>] (irq_exit+0x0/0xf0) from [<c000eda0>]
(handle_IRQ+0x54/0xa0)
[ 8606.703452]  r5:00000056 r4:c07b3f40
[ 8606.703460] [<c000ed4c>] (handle_IRQ+0x0/0xa0) from [<c0008594>]
(gic_handle_irq+0x3c/0x6c)
[ 8606.703472]  r6:c9beffb0 r5:c07c82cc r4:feffe10c r3:00000000
[ 8606.703483] [<c0008558>] (gic_handle_irq+0x0/0x6c) from
[<c05718e4>] (__irq_usr+0x44/0x60)
[ 8606.703489] Exception stack(0xc9beffb0 to 0xc9befff8)
[ 8606.703495] ffa0:                                     00000001
01581600 20e8fcf6 00000001
[ 8606.703504] ffc0: 00000013 4fb149a0 00000007 ffffffff 00000008
00000001 00000009 01580bc4
[ 8606.703512] ffe0: 0000000c b015afa0 b5de0cb8 b36b74c8 00070170
ffffffff ff121212
[ 8606.703524]  r7:ffffffff r6:ffffffff r5:00070170 r4:b36b74c8
[ 8606.703526] Mem-info:
[ 8606.703530] Normal per-cpu:
[ 8606.703535] CPU    0: hi:   90, btch:  15 usd:  10
[ 8606.703540] CPU    1: hi:   90, btch:  15 usd:  47
[ 8606.703543] HighMem per-cpu:
[ 8606.703547] CPU    0: hi:   18, btch:   3 usd:   2
[ 8606.703551] CPU    1: hi:   18, btch:   3 usd:   2
[ 8606.703564] active_anon:31649 inactive_anon:6232 isolated_anon:0
[ 8606.703564]  active_file:4303 inactive_file:17299 isolated_file:0
[ 8606.703564]  unevictable:0 dirty:146 writeback:0 unstable:0
[ 8606.703564]  free:15246 slab_reclaimable:1469 slab_unreclaimable:6629
[ 8606.703564]  mapped:17380 shmem:6266 pagetables:884 bounce:0
[ 8606.703564]  free_cma:14991
[ 8606.703590] Normal free:60684kB min:2000kB low:2500kB high:3000kB
active_anon:84188kB inactive_anon:24032kB active_file:7632kB
inactive_file:34812kB unevictable:0kB isolated(anon):0kB
isolated(file):0kB present:329728kB managed:250408kB mlocked:0kB
dirty:568kB writeback:0kB mapped:43124kB shmem:24148kB
slab_reclaimable:5876kB slab_unreclaimable:26516kB kernel_stack:2656kB
pagetables:3536kB unstable:0kB bounce:0kB free_cma:59964kB
writeback_tmp:0kB pages_scanned:68 all_unreclaimable? no
[ 8606.703610] lowmem_reserve[]: 0 696 696
[ 8606.703625] HighMem free:300kB min:128kB low:304kB high:480kB
active_anon:42408kB inactive_anon:896kB active_file:9580kB
inactive_file:34384kB unevictable:0kB isolated(anon):0kB
isolated(file):0kB present:89088kB managed:89088kB mlocked:0kB
dirty:16kB writeback:0kB mapped:26396kB shmem:916kB
slab_reclaimable:0kB slab_unreclaimable:0kB kernel_stack:0kB
pagetables:0kB unstable:0kB bounce:0kB free_cma:0kB writeback_tmp:0kB
pages_scanned:0 all_unreclaimable? no
[ 8606.703644] lowmem_reserve[]: 0 0 0
[ 8606.703676] Normal: 1013*4kB (UC) 1013*8kB (UMC) 1013*16kB (UC)
1002*32kB (UC) 4*64kB (U) 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB
0*4096kB = 60684kB
[ 8606.703706] HighMem: 3*4kB (M) 2*8kB (R) 1*16kB (R) 0*32kB 0*64kB
0*128kB 1*256kB (R) 0*512kB 0*1024kB 0*2048kB 0*4096kB = 300kB
[ 8606.703708] 27876 total pagecache pages
[ 8606.703715] 0 pages in swap cache
[ 8606.703719] Swap cache stats: add 0, delete 0, find 0/0
[ 8606.703722] Free swap  = 0kB
[ 8606.703724] Total swap = 0kB
[ 8606.703840] RTL871X: rtw_os_alloc_recvframe:can not allocate memory
for skb copy

[-- Attachment #2: page_alloc_fail_pcp_0.txt --]
[-- Type: text/plain, Size: 4810 bytes --]

[   94.586588] ksoftirqd/0: page allocation failure: order:0, mode:0x20
[   94.592934] CPU: 0 PID: 3 Comm: ksoftirqd/0 Tainted: G           O 3.10.0+ #1
[   94.600039] Backtrace: 
[   94.602512] [<c00129f8>] (dump_backtrace+0x0/0x114) from [<c0012c68>] (show_stack+0x20/0x24)
[   94.610916]  r6:cfcb6000 r5:00000000 r4:00000020 r3:271ae71c
[   94.616634] [<c0012c48>] (show_stack+0x0/0x24) from [<c056d2ec>] (dump_stack+0x24/0x28)
[   94.624613] [<c056d2c8>] (dump_stack+0x0/0x28) from [<c010c668>] (warn_alloc_failed+0xec/0x128)
[   94.633285] [<c010c57c>] (warn_alloc_failed+0x0/0x128) from [<c010fd1c>] (__alloc_pages_nodemask+0x70c/0x940)
[   94.643160]  r3:00000000 r2:00000000
[   94.646754]  r7:c07fe240 r6:00000000 r5:00000000 r4:00000020
[   94.652465] [<c010f610>] (__alloc_pages_nodemask+0x0/0x940) from [<c043ebc4>] (__netdev_alloc_frag+0x1cc/0x1e8)
[   94.662511] [<c043e9f8>] (__netdev_alloc_frag+0x0/0x1e8) from [<c044128c>] (__netdev_alloc_skb+0x84/0xe0)
[   94.672506] [<c0441208>] (__netdev_alloc_skb+0x0/0xe0) from [<bfc0134c>] (_rtw_skb_alloc+0x3c/0x40 [8812au])
[   94.682299]  r6:00000046 r5:d4af2ae8 r4:00000082 r3:00000100
[   94.688631] [<bfc01310>] (_rtw_skb_alloc+0x0/0x40 [8812au]) from [<bfc14c80>] (rtw_os_alloc_recvframe+0x6c/0xfc [8812au])
[   94.700121] [<bfc14c14>] (rtw_os_alloc_recvframe+0x0/0xfc [8812au]) from [<bfc57a2c>] (recvbuf2recvframe+0x234/0x388 [8812au])
[   94.712050] [<bfc577f8>] (recvbuf2recvframe+0x0/0x388 [8812au]) from [<bfc08438>] (usb_recv_tasklet+0x6c/0x94 [8812au])
[   94.723092] [<bfc083cc>] (usb_recv_tasklet+0x0/0x94 [8812au]) from [<c002de24>] (tasklet_action+0xa8/0x178)
[   94.732793]  r7:c07b25ec r6:00000000 r5:d4809b5c r4:d4809b58
[   94.738501] [<c002dd7c>] (tasklet_action+0x0/0x178) from [<c002cdd0>] (__do_softirq+0x164/0x344)
[   94.747245]  r8:00000000 r7:00000018 r6:c07b8098 r5:cfcb6000 r4:00000006
r3:c002dd7c
[   94.755148] [<c002cc6c>] (__do_softirq+0x0/0x344) from [<c002d018>] (run_ksoftirqd+0x68/0xdc)
[   94.763644] [<c002cfb0>] (run_ksoftirqd+0x0/0xdc) from [<c0052c34>] (smpboot_thread_fn+0x110/0x240)
[   94.772648]  r5:cfc51700 r4:cfcb6000
[   94.776252] [<c0052b24>] (smpboot_thread_fn+0x0/0x240) from [<c004a108>] (kthread+0xc4/0xc8)
[   94.784656]  r8:00000000 r7:c0052b24 r6:cfc51700 r5:00000000 r4:cfcade44
r3:cfca8540
[   94.792565] [<c004a044>] (kthread+0x0/0xc8) from [<c000e448>] (ret_from_fork+0x14/0x20)
[   94.800537]  r7:00000000 r6:00000000 r5:c004a044 r4:cfcade44
[   94.806239] Mem-info:
[   94.808503] Normal per-cpu:
[   94.811287] CPU    0: hi:   90, btch:  15 usd:   0
[   94.816056] CPU    1: hi:   90, btch:  15 usd:  14
[   94.820824] HighMem per-cpu:
[   94.823693] CPU    0: hi:   18, btch:   3 usd:   0
[   94.828463] CPU    1: hi:   18, btch:   3 usd:   0
[   94.833240] active_anon:38359 inactive_anon:138 isolated_anon:0
[   94.833240]  active_file:4407 inactive_file:15747 isolated_file:296
[   94.833240]  unevictable:0 dirty:8644 writeback:814 unstable:0
[   94.833240]  free:24064 slab_reclaimable:3878 slab_unreclaimable:5356
[   94.833240]  mapped:6988 shmem:145 pagetables:593 bounce:0
[   94.833240]  free_cma:15770
[   94.865776] Normal free:63768kB min:2000kB low:2500kB high:3000kB active_anon:128600kB inactive_anon:304kB active_file:14044kB inactive_file:36708kB unevictable:0kB isolated(anon):0kB isolated(file):1184kB present:329728kB managed:250408kB mlocked:0kB dirty:34576kB writeback:3256kB mapped:12260kB shmem:308kB slab_reclaimable:15512kB slab_unreclaimable:21424kB kernel_stack:2392kB pagetables:2372kB unstable:0kB bounce:0kB free_cma:63080kB writeback_tmp:0kB pages_scanned:599 all_unreclaimable? no
[   94.909270] lowmem_reserve[]: 0 696 696
[   94.913172] HighMem free:32460kB min:128kB low:304kB high:480kB active_anon:24836kB inactive_anon:248kB active_file:3584kB inactive_file:26316kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:89088kB managed:89088kB mlocked:0kB dirty:0kB writeback:0kB mapped:15692kB shmem:272kB slab_reclaimable:0kB slab_unreclaimable:0kB kernel_stack:0kB pagetables:0kB unstable:0kB bounce:0kB free_cma:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? no
[   94.953550] lowmem_reserve[]: 0 0 0
[   94.957093] Normal: 390*4kB (MC) 226*8kB (C) 225*16kB (C) 226*32kB (C) 226*64kB (C) 226*128kB (C) 14*256kB (C) 5*512kB (C) 0*1024kB 0*2048kB 0*4096kB = 63736kB
[   94.971626] HighMem: 1055*4kB (MR) 553*8kB (UMR) 231*16kB (UMR) 123*32kB (UMR) 91*64kB (UMR) 79*128kB (UMR) 1*256kB (R) 0*512kB 0*1024kB 0*2048kB 0*4096kB = 32468kB
[   94.986574] 20588 total pagecache pages
[   94.990397] 0 pages in swap cache
[   94.993702] Swap cache stats: add 0, delete 0, find 0/0
[   94.998902] Free swap  = 0kB
[   95.001770] Total swap = 0kB
[   95.005397] RTL871X: rtw_os_alloc_recvframe:can not allocate memory for skb copy


[-- Attachment #3: page_alloc_fail_pcp_NOT_0.txt --]
[-- Type: text/plain, Size: 5067 bytes --]

[ 8606.701343] CompositorTileW: page allocation failure: order:0, mode:0x20
[ 8606.701356] CPU: 0 PID: 26064 Comm: CompositorTileW Tainted: G           O 3.10.0+ #2
[ 8606.701365] Backtrace: 
[ 8606.701390] [<c00129f8>] (dump_backtrace+0x0/0x114) from [<c0012c68>] (show_stack+0x20/0x24)
[ 8606.701403]  r6:c9bee000 r5:00000000 r4:00000020 r3:271ae71c
[ 8606.701419] [<c0012c48>] (show_stack+0x0/0x24) from [<c056d2ec>] (dump_stack+0x24/0x28)
[ 8606.701434] [<c056d2c8>] (dump_stack+0x0/0x28) from [<c010c668>] (warn_alloc_failed+0xec/0x128)
[ 8606.701447] [<c010c57c>] (warn_alloc_failed+0x0/0x128) from [<c010fd1c>] (__alloc_pages_nodemask+0x70c/0x940)
[ 8606.701456]  r3:00000000 r2:00000000
[ 8606.701466]  r7:c07fe240 r6:00000000 r5:00000000 r4:00000020
[ 8606.701476] [<c010f610>] (__alloc_pages_nodemask+0x0/0x940) from [<c043ebc4>] (__netdev_alloc_frag+0x1cc/0x1e8)
[ 8606.701487] [<c043e9f8>] (__netdev_alloc_frag+0x0/0x1e8) from [<c044128c>] (__netdev_alloc_skb+0x84/0xe0)
[ 8606.701943] [<c0441208>] (__netdev_alloc_skb+0x0/0xe0) from [<bfbf834c>] (_rtw_skb_alloc+0x3c/0x40 [8812au])
[ 8606.701958]  r6:0000060e r5:d4af3160 r4:0000064a r3:00000100
[ 8606.702374] [<bfbf8310>] (_rtw_skb_alloc+0x0/0x40 [8812au]) from [<bfc0bc80>] (rtw_os_alloc_recvframe+0x6c/0xfc [8812au])
[ 8606.702795] [<bfc0bc14>] (rtw_os_alloc_recvframe+0x0/0xfc [8812au]) from [<bfc4eb64>] (recvbuf2recvframe+0x36c/0x388 [8812au])
[ 8606.703193] [<bfc4e7f8>] (recvbuf2recvframe+0x0/0x388 [8812au]) from [<bfbff438>] (usb_recv_tasklet+0x6c/0x94 [8812au])
[ 8606.703385] [<bfbff3cc>] (usb_recv_tasklet+0x0/0x94 [8812au]) from [<c002de24>] (tasklet_action+0xa8/0x178)
[ 8606.703398]  r7:c07b25ec r6:00000000 r5:d4809b5c r4:d4809b58
[ 8606.703407] [<c002dd7c>] (tasklet_action+0x0/0x178) from [<c002cdd0>] (__do_softirq+0x164/0x344)
[ 8606.703423]  r8:00000008 r7:00000018 r6:c07b8098 r5:c9bee000 r4:00000006
[ 8606.703423] r3:c002dd7c
[ 8606.703431] [<c002cc6c>] (__do_softirq+0x0/0x344) from [<c002d530>] (irq_exit+0xbc/0xf0)
[ 8606.703444] [<c002d474>] (irq_exit+0x0/0xf0) from [<c000eda0>] (handle_IRQ+0x54/0xa0)
[ 8606.703452]  r5:00000056 r4:c07b3f40
[ 8606.703460] [<c000ed4c>] (handle_IRQ+0x0/0xa0) from [<c0008594>] (gic_handle_irq+0x3c/0x6c)
[ 8606.703472]  r6:c9beffb0 r5:c07c82cc r4:feffe10c r3:00000000
[ 8606.703483] [<c0008558>] (gic_handle_irq+0x0/0x6c) from [<c05718e4>] (__irq_usr+0x44/0x60)
[ 8606.703489] Exception stack(0xc9beffb0 to 0xc9befff8)
[ 8606.703495] ffa0:                                     00000001 01581600 20e8fcf6 00000001
[ 8606.703504] ffc0: 00000013 4fb149a0 00000007 ffffffff 00000008 00000001 00000009 01580bc4
[ 8606.703512] ffe0: 0000000c b015afa0 b5de0cb8 b36b74c8 00070170 ffffffff ff121212
[ 8606.703524]  r7:ffffffff r6:ffffffff r5:00070170 r4:b36b74c8
[ 8606.703526] Mem-info:
[ 8606.703530] Normal per-cpu:
[ 8606.703535] CPU    0: hi:   90, btch:  15 usd:  10
[ 8606.703540] CPU    1: hi:   90, btch:  15 usd:  47
[ 8606.703543] HighMem per-cpu:
[ 8606.703547] CPU    0: hi:   18, btch:   3 usd:   2
[ 8606.703551] CPU    1: hi:   18, btch:   3 usd:   2
[ 8606.703564] active_anon:31649 inactive_anon:6232 isolated_anon:0
[ 8606.703564]  active_file:4303 inactive_file:17299 isolated_file:0
[ 8606.703564]  unevictable:0 dirty:146 writeback:0 unstable:0
[ 8606.703564]  free:15246 slab_reclaimable:1469 slab_unreclaimable:6629
[ 8606.703564]  mapped:17380 shmem:6266 pagetables:884 bounce:0
[ 8606.703564]  free_cma:14991
[ 8606.703590] Normal free:60684kB min:2000kB low:2500kB high:3000kB active_anon:84188kB inactive_anon:24032kB active_file:7632kB inactive_file:34812kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:329728kB managed:250408kB mlocked:0kB dirty:568kB writeback:0kB mapped:43124kB shmem:24148kB slab_reclaimable:5876kB slab_unreclaimable:26516kB kernel_stack:2656kB pagetables:3536kB unstable:0kB bounce:0kB free_cma:59964kB writeback_tmp:0kB pages_scanned:68 all_unreclaimable? no
[ 8606.703610] lowmem_reserve[]: 0 696 696
[ 8606.703625] HighMem free:300kB min:128kB low:304kB high:480kB active_anon:42408kB inactive_anon:896kB active_file:9580kB inactive_file:34384kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:89088kB managed:89088kB mlocked:0kB dirty:16kB writeback:0kB mapped:26396kB shmem:916kB slab_reclaimable:0kB slab_unreclaimable:0kB kernel_stack:0kB pagetables:0kB unstable:0kB bounce:0kB free_cma:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? no
[ 8606.703644] lowmem_reserve[]: 0 0 0
[ 8606.703676] Normal: 1013*4kB (UC) 1013*8kB (UMC) 1013*16kB (UC) 1002*32kB (UC) 4*64kB (U) 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 60684kB
[ 8606.703706] HighMem: 3*4kB (M) 2*8kB (R) 1*16kB (R) 0*32kB 0*64kB 0*128kB 1*256kB (R) 0*512kB 0*1024kB 0*2048kB 0*4096kB = 300kB
[ 8606.703708] 27876 total pagecache pages
[ 8606.703715] 0 pages in swap cache
[ 8606.703719] Swap cache stats: add 0, delete 0, find 0/0
[ 8606.703722] Free swap  = 0kB
[ 8606.703724] Total swap = 0kB
[ 8606.703840] RTL871X: rtw_os_alloc_recvframe:can not allocate memory for skb copy


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: page order 0 allocation fail but free pages are enough
  2016-05-23  6:47 page order 0 allocation fail but free pages are enough yoma sophian
@ 2016-05-23 14:47 ` Michal Hocko
  2016-05-23 15:31   ` yoma sophian
  0 siblings, 1 reply; 9+ messages in thread
From: Michal Hocko @ 2016-05-23 14:47 UTC (permalink / raw)
  To: yoma sophian; +Cc: linux-mm

On Mon 23-05-16 14:47:51, yoma sophian wrote:
> hi all:
> I got something wired that
> 1. in softirq, there is a page order 0 allocation request
> 2. Normal/High zone are free enough for order 0 page.
> 3. but somehow kernel return order 0 allocation fail.
> 
> My kernel version is 3.10 and below is kernel log:
> from memory info,

Can you reproduce it with the current vanlilla tree?

[...]
> [   94.586588] ksoftirqd/0: page allocation failure: order:0, mode:0x20
[...]
> [   94.865776] Normal free:63768kB min:2000kB low:2500kB high:3000kB
[...]
> [ 8606.701343] CompositorTileW: page allocation failure: order:0, mode:0x20
[...]
> [ 8606.703590] Normal free:60684kB min:2000kB low:2500kB high:3000kB

This is a lot of free memory to block GFP_ATOMIC. One possible
explanation would be that this is a race with somebody releasing a lot
of memory. The free memory is surprisingly similar in both cases.
-- 
Michal Hocko
SUSE Labs

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: page order 0 allocation fail but free pages are enough
  2016-05-23 14:47 ` Michal Hocko
@ 2016-05-23 15:31   ` yoma sophian
  2016-05-23 19:00     ` Michal Hocko
  0 siblings, 1 reply; 9+ messages in thread
From: yoma sophian @ 2016-05-23 15:31 UTC (permalink / raw)
  To: Michal Hocko; +Cc: linux-mm

hi Michal

2016-05-23 22:47 GMT+08:00, Michal Hocko <mhocko@kernel.org>:
> On Mon 23-05-16 14:47:51, yoma sophian wrote:
>> hi all:
>> I got something wired that
>> 1. in softirq, there is a page order 0 allocation request
>> 2. Normal/High zone are free enough for order 0 page.
>> 3. but somehow kernel return order 0 allocation fail.
>>
>> My kernel version is 3.10 and below is kernel log:
>> from memory info,
>
> Can you reproduce it with the current vanlilla tree?
I think it would be quite hard, since this allocation failuer comes
when a lot of program, such as Youtube, opera, etc. running on ARM
processor at the same time.
Or is there any patch in vanlilla tree I can used for checking?

>
> [...]
>> [   94.586588] ksoftirqd/0: page allocation failure: order:0, mode:0x20
> [...]
>> [   94.865776] Normal free:63768kB min:2000kB low:2500kB high:3000kB
> [...]
>> [ 8606.701343] CompositorTileW: page allocation failure: order:0,
>> mode:0x20
> [...]
>> [ 8606.703590] Normal free:60684kB min:2000kB low:2500kB high:3000kB
>
> This is a lot of free memory to block GFP_ATOMIC. One possible
> explanation would be that this is a race with somebody releasing a lot
I will try to add memory free at buffered_rmqueue like below xxx place
buffered_rmqueue -->
               if (likely(order == 0)) {
                ..................
                if (list_empty(list)) {
                        pcp->count += rmqueue_bulk(zone, 0,
                                        pcp->batch, list,
                                        migratetype, cold);
                        if (unlikely(list_empty(list)))
                                goto failed;    xxxxx ==>  to show
memory free info
                }


> of memory. The free memory is surprisingly similar in both cases.
Would you please give me any clue that free memory silimar hint the
race condition happen?

Many Appreciate your kind suggestion,

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: page order 0 allocation fail but free pages are enough
  2016-05-23 15:31   ` yoma sophian
@ 2016-05-23 19:00     ` Michal Hocko
  2016-05-24 11:40       ` yoma sophian
  0 siblings, 1 reply; 9+ messages in thread
From: Michal Hocko @ 2016-05-23 19:00 UTC (permalink / raw)
  To: yoma sophian; +Cc: linux-mm

On Mon 23-05-16 23:31:09, yoma sophian wrote:
> hi Michal
> 
> 2016-05-23 22:47 GMT+08:00, Michal Hocko <mhocko@kernel.org>:
> > On Mon 23-05-16 14:47:51, yoma sophian wrote:
> >> hi all:
> >> I got something wired that
> >> 1. in softirq, there is a page order 0 allocation request
> >> 2. Normal/High zone are free enough for order 0 page.
> >> 3. but somehow kernel return order 0 allocation fail.
> >>
> >> My kernel version is 3.10 and below is kernel log:
> >> from memory info,
> >
> > Can you reproduce it with the current vanlilla tree?
>
> I think it would be quite hard, since this allocation failuer comes
> when a lot of program, such as Youtube, opera, etc. running on ARM
> processor at the same time.
> Or is there any patch in vanlilla tree I can used for checking?

No, but 3.10 is quite old and it is preferable to reproduce your issue
on the clean and up-to-date vanilla kernel to get a better chances to
get your problem resolved.

> > [...]
> >> [   94.586588] ksoftirqd/0: page allocation failure: order:0, mode:0x20
> > [...]
> >> [   94.865776] Normal free:63768kB min:2000kB low:2500kB high:3000kB
> > [...]
> >> [ 8606.701343] CompositorTileW: page allocation failure: order:0,
> >> mode:0x20
> > [...]
> >> [ 8606.703590] Normal free:60684kB min:2000kB low:2500kB high:3000kB
> >
> > This is a lot of free memory to block GFP_ATOMIC. One possible
> > explanation would be that this is a race with somebody releasing a lot
> I will try to add memory free at buffered_rmqueue like below xxx place
> buffered_rmqueue -->
>                if (likely(order == 0)) {
>                 ..................
>                 if (list_empty(list)) {
>                         pcp->count += rmqueue_bulk(zone, 0,
>                                         pcp->batch, list,
>                                         migratetype, cold);
>                         if (unlikely(list_empty(list)))
>                                 goto failed;    xxxxx ==>  to show
> memory free info

I would just mark NR_FREE_PAGES before and after allocation request.
Something like:
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index f8f3bfc435ee..a1337aa7e897 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -3565,6 +3565,9 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order,
 	enum compact_result compact_result;
 	int compaction_retries = 0;
 	int no_progress_loops = 0;
+	unsigned long nr_free_before;
+	
+	nr_free_before = global_page_state(NR_FREE_PAGES);
 
 	/*
 	 * In the slowpath, we sanity check order to avoid ever trying to
@@ -3624,6 +3627,7 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order,
 		 * to fail.
 		 */
 		WARN_ON_ONCE(gfp_mask & __GFP_NOFAIL);
+		pr_info("nr_free_before:%lu nr_free_now:%lu\n", nr_free_before, global_page_state(NR_FREE_PAGES));
 		goto nopage;
 	}
 
You can then compare the numbers before after and the allocation failure
to see whether there is a large gap.
-- 
Michal Hocko
SUSE Labs

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

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: page order 0 allocation fail but free pages are enough
  2016-05-23 19:00     ` Michal Hocko
@ 2016-05-24 11:40       ` yoma sophian
  2016-05-24 11:50         ` Michal Hocko
  0 siblings, 1 reply; 9+ messages in thread
From: yoma sophian @ 2016-05-24 11:40 UTC (permalink / raw)
  To: Michal Hocko; +Cc: linux-mm

[-- Attachment #1: Type: text/plain, Size: 7770 bytes --]

hi Michal:

> I would just mark NR_FREE_PAGES before and after allocation request.
> Something like:
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index f8f3bfc435ee..a1337aa7e897 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -3565,6 +3565,9 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order,
>         enum compact_result compact_result;
>         int compaction_retries = 0;
>         int no_progress_loops = 0;
> +       unsigned long nr_free_before;
> +
> +       nr_free_before = global_page_state(NR_FREE_PAGES);
>
>         /*
>          * In the slowpath, we sanity check order to avoid ever trying to
> @@ -3624,6 +3627,7 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order,
>                  * to fail.
>                  */
>                 WARN_ON_ONCE(gfp_mask & __GFP_NOFAIL);
> +               pr_info("nr_free_before:%lu nr_free_now:%lu\n", nr_free_before, global_page_state(NR_FREE_PAGES));
>                 goto nopage;
>         }
>
> You can then compare the numbers before after and the allocation failure
> to see whether there is a large gap.
I follow your suggestion to add nr_free_before for comparing when
allocation failure comes out.
from the log, it shows that nr_free_before has lot of free pages and
the value is the same even allocation fail.

It seems there are some other conditions that will let page order =0
with GFP_ATOMIC (mode = 0x20) fail even free pages and pcp is enough.

Sincerely appreciate your kind help,

nr_free_before:14094 nr_free_now:14094
opera_omi: page allocation failure: order:0, mode:0x20
CPU: 0 PID: 20846 Comm: opera_omi Tainted: G           O 3.10.0+ #14
Backtrace:
[<c00129f8>] (dump_backtrace+0x0/0x114) from [<c0012c68>] (show_stack+0x20/0x24)
 r6:ca01e000 r5:00000000 r4:00000020 r3:271ae71c
[<c0012c48>] (show_stack+0x0/0x24) from [<c056d32c>] (dump_stack+0x24/0x28)
[<c056d308>] (dump_stack+0x0/0x28) from [<c010c668>]
(warn_alloc_failed+0xec/0x128)
[<c010c57c>] (warn_alloc_failed+0x0/0x128) from [<c010fd58>]
(__alloc_pages_nodemask+0x748/0x97c)
 r3:00000000 r2:00000000
 r7:c07fe240 r6:00000000 r5:00000000 r4:00000020
[<c010f610>] (__alloc_pages_nodemask+0x0/0x97c) from [<c043ec04>]
(__netdev_alloc_frag+0x1cc/0x1e8)
[<c043ea38>] (__netdev_alloc_frag+0x0/0x1e8) from [<c04412cc>]
(__netdev_alloc_skb+0x84/0xe0)
[<c0441248>] (__netdev_alloc_skb+0x0/0xe0) from [<bfbf834c>]
(_rtw_skb_alloc+0x3c/0x40 [8812au])
 r6:0000007a r5:d4899168 r4:000000b6 r3:00000100
[<bfbf8310>] (_rtw_skb_alloc+0x0/0x40 [8812au]) from [<bfc0bc80>]
(rtw_os_alloc_recvframe+0x6c/0xfc [8812au])
[<bfc0bc14>] (rtw_os_alloc_recvframe+0x0/0xfc [8812au]) from
[<bfc4ea2c>] (recvbuf2recvframe+0x234/0x388 [8812au])
[<bfc4e7f8>] (recvbuf2recvframe+0x0/0x388 [8812au]) from [<bfbff438>]
(usb_recv_tasklet+0x6c/0x94 [8812au])
[<bfbff3cc>] (usb_recv_tasklet+0x0/0x94 [8812au]) from [<c002de24>]
(tasklet_action+0xa8/0x178)
 r7:c07b25ec r6:00000000 r5:d4809b5c r4:d4809b58
[<c002dd7c>] (tasklet_action+0x0/0x178) from [<c002cdd0>]
(__do_softirq+0x164/0x344)
 r8:cd919484 r7:00000018 r6:c07b8098 r5:ca01e000 r4:00000006
r3:c002dd7c
[<c002cc6c>] (__do_softirq+0x0/0x344) from [<c002d530>] (irq_exit+0xbc/0xf0)
[<c002d474>] (irq_exit+0x0/0xf0) from [<c000eda0>] (handle_IRQ+0x54/0xa0)
 r5:00000056 r4:c07b3f40
[<c000ed4c>] (handle_IRQ+0x0/0xa0) from [<c0008594>] (gic_handle_irq+0x3c/0x6c)
 r6:ca01fa00 r5:c07c82cc r4:feffe10c r3:00000000
[<c0008558>] (gic_handle_irq+0x0/0x6c) from [<c0571744>] (__irq_svc+0x44/0x78)
Exception stack(0xca01fa00 to 0xca01fa48)
fa00: cd919484 00000000 deaf1eed 80000001 cd919484 ca01fac0 00003175 00000000
fa20: cd919484 00000000 0000000c ca01fa5c ca01fa60 ca01fa48 c0570e0c c0294ee8
fa40: 880f0153 ffffffff 00000000
 r7:ca01fa34 r6:ffffffff r5:880f0153 r4:c0294ee8
[<c0294eb4>] (do_raw_read_lock+0x0/0x54) from [<c0570e0c>]
(_raw_read_lock+0x28/0x2c)
 r4:cd919484 r3:00000000
[<c0570de4>] (_raw_read_lock+0x0/0x2c) from [<c01f0940>]
(ext4_es_lookup_extent+0x30/0x1dc)
 r4:cd9192c8 r3:00000000
[<c01f0910>] (ext4_es_lookup_extent+0x0/0x1dc) from [<c01b5b18>]
(ext4_map_blocks+0x40/0x4cc)
 r8:00000000 r7:00000000 r6:cd9192c8 r5:00000000 r4:ca01fb18
r3:00000000
[<c01b5ad8>] (ext4_map_blocks+0x0/0x4cc) from [<c01b6038>]
(_ext4_get_block+0x94/0x188)
[<c01b5fa4>] (_ext4_get_block+0x0/0x188) from [<c01b6160>]
(ext4_get_block+0x34/0x3c)
 r9:00000000 r8:ca01fc40 r7:00000000 r6:00003175 r5:00000001
r4:00000000
[<c01b612c>] (ext4_get_block+0x0/0x3c) from [<c01873e8>]
(do_mpage_readpage+0x5ac/0x748)
[<c0186e3c>] (do_mpage_readpage+0x0/0x748) from [<c0187660>]
(mpage_readpages+0xdc/0x138)
[<c0187584>] (mpage_readpages+0x0/0x138) from [<c01b531c>]
(ext4_readpages+0x50/0x54)
[<c01b52cc>] (ext4_readpages+0x0/0x54) from [<c0113628>]
(__do_page_cache_readahead+0x1ac/0x260)
 r6:0000369a r5:00000020 r4:c01b52cc r3:00000014
[<c011347c>] (__do_page_cache_readahead+0x0/0x260) from [<c0113d88>]
(ra_submit+0x38/0x40)
[<c0113d50>] (ra_submit+0x0/0x40) from [<c01097e8>] (filemap_fault+0x3e4/0x438)
[<c0109404>] (filemap_fault+0x0/0x438) from [<c012997c>] (__do_fault+0x80/0x5d4)
[<c01298fc>] (__do_fault+0x0/0x5d4) from [<c012cbe4>]
(handle_pte_fault+0x84/0x6b0)
[<c012cb60>] (handle_pte_fault+0x0/0x6b0) from [<c012d29c>]
(handle_mm_fault+0x8c/0xbc)
[<c012d210>] (handle_mm_fault+0x0/0xbc) from [<c057354c>]
(do_page_fault+0x310/0x428)
[<c057323c>] (do_page_fault+0x0/0x428) from [<c000840c>]
(do_DataAbort+0x48/0xac)
[<c00083c4>] (do_DataAbort+0x0/0xac) from [<c05718dc>] (__dabt_usr+0x3c/0x40)
Exception stack(0xca01ffb0 to 0xca01fff8)
ffa0:                                     599ccd49 b59735cc 000048c4 b5e3784c
ffc0: 019e6fc8 b5e24cb8 00100080 00000000 be539aec 0196fc00 be5399e0 019e6fc8
ffe0: 00020817 be5398a0 b3bd4765 b3cf394a 280f0170 ffffffff ff131313
 r8:be539aec r7:00000000 r6:ffffffff r5:280f0170 r4:b3cf394a
Mem-info:
Normal per-cpu:
CPU    0: hi:   90, btch:  15 usd:  11
CPU    1: hi:   90, btch:  15 usd:  21
HighMem per-cpu:
CPU    0: hi:   18, btch:   3 usd:   1
CPU    1: hi:   18, btch:   3 usd:   2
active_anon:54429 inactive_anon:1744 isolated_anon:0
 active_file:2226 inactive_file:3338 isolated_file:0
 unevictable:0 dirty:44 writeback:0 unstable:0
 free:14094 slab_reclaimable:1380 slab_unreclaimable:6532
 mapped:4755 shmem:1772 pagetables:1106 bounce:0
 free_cma:13863
Normal free:56088kB min:2000kB low:2500kB high:3000kB
active_anon:148332kB inactive_anon:6040kB active_file:1356kB
inactive_file:5240kB unevictable:0kB isolated(anon):0kB
isolated(file):0kB present:329728kB managed:250408kB mlocked:0kB
dirty:120kB writeback:0kB mapped:8108kB shmem:6136kB
slab_reclaimable:5520kB slab_unreclaimable:26128kB kernel_stack:2720kB
pagetables:4424kB unstable:0kB bounce:0kB free_cma:55452kB
writeback_tmp:0kB pages_scanned:0 all_unreclaimable? no
lowmem_reserve[]: 0 696 696
HighMem free:288kB min:128kB low:304kB high:480kB active_anon:69384kB
inactive_anon:936kB active_file:7548kB inactive_file:8112kB
unevictable:0kB isolated(anon):0kB isolated(file):0kB present:89088kB
managed:89088kB mlocked:0kB dirty:56kB writeback:0kB mapped:10912kB
shmem:952kB slab_reclaimable:0kB slab_unreclaimable:0kB
kernel_stack:0kB pagetables:0kB unstable:0kB bounce:0kB free_cma:0kB
writeback_tmp:0kB pages_scanned:11 all_unreclaimable? no
lowmem_reserve[]: 0 0 0
Normal: 2152*4kB (UEC) 2157*8kB (UEC) 1889*16kB (UEC) 0*32kB 0*64kB
0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 56088kB
HighMem: 10*4kB (R) 21*8kB (R) 1*16kB (R) 0*32kB 1*64kB (R) 0*128kB
0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 288kB
7360 total pagecache pages
0 pages in swap cache
Swap cache stats: add 0, delete 0, find 0/0
Free swap  = 0kB
Total swap = 0kB
RTL871X: rtw_os_alloc_recvframe:can not allocate memory for skb copy
RTL871X: pre_recv_entry()-274: alloc_skb() failed!

[-- Attachment #2: 05-24_page_order0_nr_free_before.txt --]
[-- Type: text/plain, Size: 13208 bytes --]

[ 6571.049922] nr_free_before:14139 nr_free_now:14139
[ 6571.054710] nr_free_before:14094 nr_free_now:14094
[ 6571.059490] CrBrowserMain: page allocation failure: order:0, mode:0x280020
[ 6571.066345] CPU: 1 PID: 20819 Comm: CrBrowserMain Tainted: G           O 3.10.0+ #14
[ 6571.074054] Backtrace: 
[ 6571.076529] [<c00129f8>] (dump_backtrace+0x0/0x114) from [<c0012c68>] (show_stack+0x20/0x24)
[ 6571.084932]  r6:c262a000 r5:00000000 r4:00280020 r3:271ae71c
[ 6571.090649] [<c0012c48>] (show_stack+0x0/0x24) from [<c056d32c>] (dump_stack+0x24/0x28)
[ 6571.098628] [<c056d308>] (dump_stack+0x0/0x28) from [<c010c668>] (warn_alloc_failed+0xec/0x128)
[ 6571.107305] [<c010c57c>] (warn_alloc_failed+0x0/0x128) from [<c010fd58>] (__alloc_pages_nodemask+0x748/0x97c)
[ 6571.117176]  r3:00000000 r2:00000000
[ 6571.120770]  r7:c07fe240 r6:00000000 r5:00000000 r4:00280020
[ 6571.126485] [<c010f610>] (__alloc_pages_nodemask+0x0/0x97c) from [<c0141ca4>] (new_slab+0x22c/0x2a8)
[ 6571.135589] [<c0141a78>] (new_slab+0x0/0x2a8) from [<c01440f8>] (__slab_alloc.isra.61.constprop.69+0x588/0x760)
[ 6571.145636]  r8:c07c7cc4 r7:cf4fcc00 r6:c1d2aa08 r5:00000020 r4:00000000
[ 6571.152401] [<c0143b70>] (__slab_alloc.isra.61.constprop.69+0x0/0x760) from [<c0144650>] (kmem_cache_alloc+0x184/0x1c0)
[ 6571.163142] [<c01444cc>] (kmem_cache_alloc+0x0/0x1c0) from [<c01efb34>] (__es_insert_extent+0xc4/0x274)
[ 6571.172494] [<c01efa70>] (__es_insert_extent+0x0/0x274) from [<c01f087c>] (ext4_es_insert_extent+0x128/0x134)
[ 6571.182377] [<c01f0754>] (ext4_es_insert_extent+0x0/0x134) from [<c01b5cf8>] (ext4_map_blocks+0x220/0x4cc)
[ 6571.191990]  r9:00000000 r8:00000006 r7:00000000 r6:cd9192c8 r5:00000000
r4:c262bb18
[ 6571.199894] [<c01b5ad8>] (ext4_map_blocks+0x0/0x4cc) from [<c01b6038>] (_ext4_get_block+0x94/0x188)
[ 6571.208905] [<c01b5fa4>] (_ext4_get_block+0x0/0x188) from [<c01b6160>] (ext4_get_block+0x34/0x3c)
[ 6571.217737]  r9:00000000 r8:c262bc40 r7:00000000 r6:000008a6 r5:00000001
r4:00000000
[ 6571.225648] [<c01b612c>] (ext4_get_block+0x0/0x3c) from [<c01873e8>] (do_mpage_readpage+0x5ac/0x748)
[ 6571.234748] [<c0186e3c>] (do_mpage_readpage+0x0/0x748) from [<c0187660>] (mpage_readpages+0xdc/0x138)
[ 6571.243932] [<c0187584>] (mpage_readpages+0x0/0x138) from [<c01b531c>] (ext4_readpages+0x50/0x54)
[ 6571.252774] [<c01b52cc>] (ext4_readpages+0x0/0x54) from [<c0113628>] (__do_page_cache_readahead+0x1ac/0x260)
[ 6571.262561]  r6:0000369a r5:00000020 r4:c01b52cc r3:00000015
[ 6571.268272] [<c011347c>] (__do_page_cache_readahead+0x0/0x260) from [<c0113d88>] (ra_submit+0x38/0x40)
[ 6571.277540] [<c0113d50>] (ra_submit+0x0/0x40) from [<c01097e8>] (filemap_fault+0x3e4/0x438)
[ 6571.285862] [<c0109404>] (filemap_fault+0x0/0x438) from [<c012997c>] (__do_fault+0x80/0x5d4)
[ 6571.294269] [<c01298fc>] (__do_fault+0x0/0x5d4) from [<c012cbe4>] (handle_pte_fault+0x84/0x6b0)
[ 6571.302934] [<c012cb60>] (handle_pte_fault+0x0/0x6b0) from [<c012d29c>] (handle_mm_fault+0x8c/0xbc)
[ 6571.311950] [<c012d210>] (handle_mm_fault+0x0/0xbc) from [<c057354c>] (do_page_fault+0x310/0x428)
[ 6571.320793] [<c057323c>] (do_page_fault+0x0/0x428) from [<c00084b4>] (do_PrefetchAbort+0x44/0xac)
[ 6571.329631] [<c0008470>] (do_PrefetchAbort+0x0/0xac) from [<c0571b3c>] (ret_from_exception+0x0/0x10)
[ 6571.338724] Exception stack(0xc262bfb0 to 0xc262bff8)
[ 6571.343754] bfa0:                                     ab718d50 00000000 00000000 00000000
[ 6571.351903] bfc0: ab718d50 ab7195b8 ab719108 b5e7ccb8 00000000 ab718c98 01120514 0118ca80
[ 6571.360050] bfe0: 00000000 ab718c80 b2e2d945 b30e56d8 40000170 ffffffff 5a5a5a5a
[ 6571.367417]  r8:00000000 r7:b5e7ccb8 r6:ffffffff r5:40000170 r4:b30e56d8
[ 6571.374173] Mem-info:
[ 6571.376437] Normal per-cpu:
[ 6571.379220] CPU    0: hi:   90, btch:  15 usd:  11
[ 6571.383988] CPU    1: hi:   90, btch:  15 usd:  21
[ 6571.388757] HighMem per-cpu:
[ 6571.391626] CPU    0: hi:   18, btch:   3 usd:   1
[ 6571.396395] CPU    1: hi:   18, btch:   3 usd:   2
[ 6571.401173] active_anon:54429 inactive_anon:1744 isolated_anon:0
[ 6571.401173]  active_file:2226 inactive_file:3338 isolated_file:0
[ 6571.401173]  unevictable:0 dirty:44 writeback:0 unstable:0
[ 6571.401173]  free:14094 slab_reclaimable:1380 slab_unreclaimable:6532
[ 6571.401173]  mapped:4755 shmem:1772 pagetables:1106 bounce:0
[ 6571.401173]  free_cma:13863
[ 6571.433364] Normal free:56088kB min:2000kB low:2500kB high:3000kB active_anon:148332kB inactive_anon:6040kB active_file:1356kB inactive_file:5240kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:329728kB managed:250408kB mlocked:0kB dirty:120kB writeback:0kB mapped:8108kB shmem:6136kB slab_reclaimable:5520kB slab_unreclaimable:26128kB kernel_stack:2720kB pagetables:4424kB unstable:0kB bounce:0kB free_cma:55452kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? no
[ 6571.475821] lowmem_reserve[]: 0 696 696
[ 6571.479723] HighMem free:288kB min:128kB low:304kB high:480kB active_anon:69384kB inactive_anon:936kB active_file:7548kB inactive_file:8112kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:89088kB managed:89088kB mlocked:0kB dirty:56kB writeback:0kB mapped:10912kB shmem:952kB slab_reclaimable:0kB slab_unreclaimable:0kB kernel_stack:0kB pagetables:0kB unstable:0kB bounce:0kB free_cma:0kB writeback_tmp:0kB pages_scanned:11 all_unreclaimable? no
[ 6571.520014] lowmem_reserve[]: 0 0 0
[ 6571.523557] Normal: 2152*4kB (UEC) [ 6571.526570] nr_free_before:14094 nr_free_now:14094
[ 6571.526576] nr_free_before:14094 nr_free_now:14094
[ 6571.526581] nr_free_before:14094 nr_free_now:14094
[ 6571.526586] nr_free_before:14094 nr_free_now:14094
[ 6571.526592] opera_omi: page allocation failure: order:0, mode:0x20
[ 6571.526600] CPU: 0 PID: 20846 Comm: opera_omi Tainted: G           O 3.10.0+ #14
[ 6571.526605] Backtrace: 
[ 6571.526625] [<c00129f8>] (dump_backtrace+0x0/0x114) from [<c0012c68>] (show_stack+0x20/0x24)
[ 6571.526630]  r6:ca01e000 r5:00000000 r4:00000020 r3:271ae71c
[ 6571.526654] [<c0012c48>] (show_stack+0x0/0x24) from [<c056d32c>] (dump_stack+0x24/0x28)
[ 6571.526666] [<c056d308>] (dump_stack+0x0/0x28) from [<c010c668>] (warn_alloc_failed+0xec/0x128)
[ 6571.526679] [<c010c57c>] (warn_alloc_failed+0x0/0x128) from [<c010fd58>] (__alloc_pages_nodemask+0x748/0x97c)
[ 6571.526685]  r3:00000000 r2:00000000
[ 6571.526691]  r7:c07fe240 r6:00000000 r5:00000000 r4:00000020
[ 6571.526711] [<c010f610>] (__alloc_pages_nodemask+0x0/0x97c) from [<c043ec04>] (__netdev_alloc_frag+0x1cc/0x1e8)
[ 6571.526722] [<c043ea38>] (__netdev_alloc_frag+0x0/0x1e8) from [<c04412cc>] (__netdev_alloc_skb+0x84/0xe0)
[ 6571.527153] [<c0441248>] (__netdev_alloc_skb+0x0/0xe0) from [<bfbf834c>] (_rtw_skb_alloc+0x3c/0x40 [8812au])
[ 6571.527162]  r6:0000007a r5:d4899168 r4:000000b6 r3:00000100
[ 6571.527577] [<bfbf8310>] (_rtw_skb_alloc+0x0/0x40 [8812au]) from [<bfc0bc80>] (rtw_os_alloc_recvframe+0x6c/0xfc [8812au])
[ 6571.528001] [<bfc0bc14>] (rtw_os_alloc_recvframe+0x0/0xfc [8812au]) from [<bfc4ea2c>] (recvbuf2recvframe+0x234/0x388 [8812au])
[ 6571.528401] [<bfc4e7f8>] (recvbuf2recvframe+0x0/0x388 [8812au]) from [<bfbff438>] (usb_recv_tasklet+0x6c/0x94 [8812au])
[ 6571.528590] [<bfbff3cc>] (usb_recv_tasklet+0x0/0x94 [8812au]) from [<c002de24>] (tasklet_action+0xa8/0x178)
[ 6571.528596]  r7:c07b25ec r6:00000000 r5:d4809b5c r4:d4809b58
[ 6571.528614] [<c002dd7c>] (tasklet_action+0x0/0x178) from [<c002cdd0>] (__do_softirq+0x164/0x344)
[ 6571.528619]  r8:cd919484 r7:00000018 r6:c07b8098 r5:ca01e000 r4:00000006
[ 6571.528631] r3:c002dd7c
[ 6571.528641] [<c002cc6c>] (__do_softirq+0x0/0x344) from [<c002d530>] (irq_exit+0xbc/0xf0)
[ 6571.528653] [<c002d474>] (irq_exit+0x0/0xf0) from [<c000eda0>] (handle_IRQ+0x54/0xa0)
[ 6571.528658]  r5:00000056 r4:c07b3f40
[ 6571.528670] [<c000ed4c>] (handle_IRQ+0x0/0xa0) from [<c0008594>] (gic_handle_irq+0x3c/0x6c)
[ 6571.528674]  r6:ca01fa00 r5:c07c82cc r4:feffe10c r3:00000000
[ 6571.528692] [<c0008558>] (gic_handle_irq+0x0/0x6c) from [<c0571744>] (__irq_svc+0x44/0x78)
[ 6571.528698] Exception stack(0xca01fa00 to 0xca01fa48)
[ 6571.528707] fa00: cd919484 00000000 deaf1eed 80000001 cd919484 ca01fac0 00003175 00000000
[ 6571.528716] fa20: cd919484 00000000 0000000c ca01fa5c ca01fa60 ca01fa48 c0570e0c c0294ee8
[ 6571.528722] fa40: 880f0153 ffffffff 00000000
[ 6571.528726]  r7:ca01fa34 r6:ffffffff r5:880f0153 r4:c0294ee8
[ 6571.528748] [<c0294eb4>] (do_raw_read_lock+0x0/0x54) from [<c0570e0c>] (_raw_read_lock+0x28/0x2c)
[ 6571.528753]  r4:cd919484 r3:00000000
[ 6571.528766] [<c0570de4>] (_raw_read_lock+0x0/0x2c) from [<c01f0940>] (ext4_es_lookup_extent+0x30/0x1dc)
[ 6571.528771]  r4:cd9192c8 r3:00000000
[ 6571.528787] [<c01f0910>] (ext4_es_lookup_extent+0x0/0x1dc) from [<c01b5b18>] (ext4_map_blocks+0x40/0x4cc)
[ 6571.528792]  r8:00000000 r7:00000000 r6:cd9192c8 r5:00000000 r4:ca01fb18
[ 6571.528804] r3:00000000
[ 6571.528816] [<c01b5ad8>] (ext4_map_blocks+0x0/0x4cc) from [<c01b6038>] (_ext4_get_block+0x94/0x188)
[ 6571.528827] [<c01b5fa4>] (_ext4_get_block+0x0/0x188) from [<c01b6160>] (ext4_get_block+0x34/0x3c)
[ 6571.528832]  r9:00000000 r8:ca01fc40 r7:00000000 r6:00003175 r5:00000001
[ 6571.528845] r4:00000000
[ 6571.528859] [<c01b612c>] (ext4_get_block+0x0/0x3c) from [<c01873e8>] (do_mpage_readpage+0x5ac/0x748)
[ 6571.528871] [<c0186e3c>] (do_mpage_readpage+0x0/0x748) from [<c0187660>] (mpage_readpages+0xdc/0x138)
[ 6571.528883] [<c0187584>] (mpage_readpages+0x0/0x138) from [<c01b531c>] (ext4_readpages+0x50/0x54)
[ 6571.528898] [<c01b52cc>] (ext4_readpages+0x0/0x54) from [<c0113628>] (__do_page_cache_readahead+0x1ac/0x260)
[ 6571.528903]  r6:0000369a r5:00000020 r4:c01b52cc r3:00000014
[ 6571.528922] [<c011347c>] (__do_page_cache_readahead+0x0/0x260) from [<c0113d88>] (ra_submit+0x38/0x40)
[ 6571.528932] [<c0113d50>] (ra_submit+0x0/0x40) from [<c01097e8>] (filemap_fault+0x3e4/0x438)
[ 6571.528943] [<c0109404>] (filemap_fault+0x0/0x438) from [<c012997c>] (__do_fault+0x80/0x5d4)
[ 6571.528953] [<c01298fc>] (__do_fault+0x0/0x5d4) from [<c012cbe4>] (handle_pte_fault+0x84/0x6b0)
[ 6571.528963] [<c012cb60>] (handle_pte_fault+0x0/0x6b0) from [<c012d29c>] (handle_mm_fault+0x8c/0xbc)
[ 6571.528975] [<c012d210>] (handle_mm_fault+0x0/0xbc) from [<c057354c>] (do_page_fault+0x310/0x428)
[ 6571.528985] [<c057323c>] (do_page_fault+0x0/0x428) from [<c000840c>] (do_DataAbort+0x48/0xac)
[ 6571.528994] [<c00083c4>] (do_DataAbort+0x0/0xac) from [<c05718dc>] (__dabt_usr+0x3c/0x40)
[ 6571.529000] Exception stack(0xca01ffb0 to 0xca01fff8)
[ 6571.529006] ffa0:                                     599ccd49 b59735cc 000048c4 b5e3784c
[ 6571.529016] ffc0: 019e6fc8 b5e24cb8 00100080 00000000 be539aec 0196fc00 be5399e0 019e6fc8
[ 6571.529024] ffe0: 00020817 be5398a0 b3bd4765 b3cf394a 280f0170 ffffffff ff131313
[ 6571.529028]  r8:be539aec r7:00000000 r6:ffffffff r5:280f0170 r4:b3cf394a
[ 6571.529042] Mem-info:
[ 6571.529045] Normal per-cpu:
[ 6571.529050] CPU    0: hi:   90, btch:  15 usd:  11
[ 6571.529056] CPU    1: hi:   90, btch:  15 usd:  21
[ 6571.529059] HighMem per-cpu:
[ 6571.529063] CPU    0: hi:   18, btch:   3 usd:   1
[ 6571.529067] CPU    1: hi:   18, btch:   3 usd:   2
[ 6571.529080] active_anon:54429 inactive_anon:1744 isolated_anon:0
[ 6571.529080]  active_file:2226 inactive_file:3338 isolated_file:0
[ 6571.529080]  unevictable:0 dirty:44 writeback:0 unstable:0
[ 6571.529080]  free:14094 slab_reclaimable:1380 slab_unreclaimable:6532
[ 6571.529080]  mapped:4755 shmem:1772 pagetables:1106 bounce:0
[ 6571.529080]  free_cma:13863
[ 6571.529104] Normal free:56088kB min:2000kB low:2500kB high:3000kB active_anon:148332kB inactive_anon:6040kB active_file:1356kB inactive_file:5240kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:329728kB managed:250408kB mlocked:0kB dirty:120kB writeback:0kB mapped:8108kB shmem:6136kB slab_reclaimable:5520kB slab_unreclaimable:26128kB kernel_stack:2720kB pagetables:4424kB unstable:0kB bounce:0kB free_cma:55452kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? no
[ 6571.529118] lowmem_reserve[]: 0 696 696
[ 6571.529142] HighMem free:288kB min:128kB low:304kB high:480kB active_anon:69384kB inactive_anon:936kB active_file:7548kB inactive_file:8112kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:89088kB managed:89088kB mlocked:0kB dirty:56kB writeback:0kB mapped:10912kB shmem:952kB slab_reclaimable:0kB slab_unreclaimable:0kB kernel_stack:0kB pagetables:0kB unstable:0kB bounce:0kB free_cma:0kB writeback_tmp:0kB pages_scanned:11 all_unreclaimable? no
[ 6571.529155] lowmem_reserve[]: 0 0 0
[ 6571.529164] Normal: 2152*4kB (UEC) 2157*8kB (UEC) 1889*16kB (UEC) 0*32kB 0*64kB 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 56088kB
[ 6571.529199] HighMem: 10*4kB (R) 21*8kB (R) 1*16kB (R) 0*32kB 1*64kB (R) 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 288kB
[ 6571.529234] 7360 total pagecache pages
[ 6571.529241] 0 pages in swap cache
[ 6571.529245] Swap cache stats: add 0, delete 0, find 0/0
[ 6571.529248] Free swap  = 0kB
[ 6571.529250] Total swap = 0kB
[ 6571.529649] RTL871X: rtw_os_alloc_recvframe:can not allocate memory for skb copy
[ 6571.529658] RTL871X: pre_recv_entry()-274: alloc_skb() failed!


[-- Attachment #3: 2016.05.24.nr_free_before.patch --]
[-- Type: text/x-patch, Size: 690 bytes --]

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 3366092..5e7487a 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -2414,6 +2414,8 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order,
 	bool sync_migration = false;
 	bool deferred_compaction = false;
 	bool contended_compaction = false;
+	unsigned long nr_free_before;
+	nr_free_before = global_page_state(NR_FREE_PAGES);
 
 	/*
 	 * In the slowpath, we sanity check order to avoid ever trying to
@@ -2597,6 +2599,7 @@ rebalance:
 	}
 
 nopage:
+	printk(KERN_ERR"nr_free_before:%lu nr_free_now:%lu\n", nr_free_before, global_page_state(NR_FREE_PAGES));
 	warn_alloc_failed(gfp_mask, order, NULL);
 	return page;
 got_pg:

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: page order 0 allocation fail but free pages are enough
  2016-05-24 11:40       ` yoma sophian
@ 2016-05-24 11:50         ` Michal Hocko
  2016-05-24 15:06           ` yoma sophian
  0 siblings, 1 reply; 9+ messages in thread
From: Michal Hocko @ 2016-05-24 11:50 UTC (permalink / raw)
  To: yoma sophian; +Cc: linux-mm

OK, I could have noticed that earlier...

On Tue 24-05-16 19:40:21, yoma sophian wrote:
[...]
> Normal free:56088kB min:2000kB low:2500kB high:3000kB
> active_anon:148332kB inactive_anon:6040kB active_file:1356kB
> inactive_file:5240kB unevictable:0kB isolated(anon):0kB
> isolated(file):0kB present:329728kB managed:250408kB mlocked:0kB
> dirty:120kB writeback:0kB mapped:8108kB shmem:6136kB
> slab_reclaimable:5520kB slab_unreclaimable:26128kB kernel_stack:2720kB
> pagetables:4424kB unstable:0kB bounce:0kB free_cma:55452kB

free-free_cma = 636kB so you are way below the watermark and that is
why your atomic allocation fails (see __zone_watermark_ok). I am not an
expect on CMA but I guess your CMA pool is too large for your load.
-- 
Michal Hocko
SUSE Labs

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: page order 0 allocation fail but free pages are enough
  2016-05-24 11:50         ` Michal Hocko
@ 2016-05-24 15:06           ` yoma sophian
  2016-05-25  2:11             ` yoma sophian
  0 siblings, 1 reply; 9+ messages in thread
From: yoma sophian @ 2016-05-24 15:06 UTC (permalink / raw)
  To: Michal Hocko; +Cc: linux-mm

hi Michal:

>> Normal free:56088kB min:2000kB low:2500kB high:3000kB
>> active_anon:148332kB inactive_anon:6040kB active_file:1356kB
>> inactive_file:5240kB unevictable:0kB isolated(anon):0kB
>> isolated(file):0kB present:329728kB managed:250408kB mlocked:0kB
>> dirty:120kB writeback:0kB mapped:8108kB shmem:6136kB
>> slab_reclaimable:5520kB slab_unreclaimable:26128kB kernel_stack:2720kB
>> pagetables:4424kB unstable:0kB bounce:0kB free_cma:55452kB
>
> free-free_cma = 636kB so you are way below the watermark and that is
After tracing the __alloc_pages_slowpath, in the 2nd time we call
get_page_from_freelist, we will purposely put alloc_flags &
~ALLOC_NO_WATERMARKS.
Doesn't that mean kernel will bypass __zone_watermark_ok?

Sincerely appreciate your kind help ^^

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: page order 0 allocation fail but free pages are enough
  2016-05-24 15:06           ` yoma sophian
@ 2016-05-25  2:11             ` yoma sophian
  2016-05-25  6:31               ` Michal Hocko
  0 siblings, 1 reply; 9+ messages in thread
From: yoma sophian @ 2016-05-25  2:11 UTC (permalink / raw)
  To: Michal Hocko; +Cc: linux-mm

>> free-free_cma = 636kB so you are way below the watermark and that is
> After tracing the __alloc_pages_slowpath, in the 2nd time we call
> get_page_from_freelist, we will purposely put alloc_flags &
> ~ALLOC_NO_WATERMARKS.
> Doesn't that mean kernel will bypass __zone_watermark_ok?
I apologize for my misunderstanding.
(alloc_flags & ~ALLOC_NO_WATERMARKS) will NOT bypass __zone_watermark_ok.
on the contrary, it will filter out watermarks checking.

there is one thing makes me curious,
why we put  alloc_flags = gfp_to_alloc_flags(gfp_mask) in
__alloc_pages_slowpath  instead of __alloc_pages_nodemask?

Appreciate your kind help,

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: page order 0 allocation fail but free pages are enough
  2016-05-25  2:11             ` yoma sophian
@ 2016-05-25  6:31               ` Michal Hocko
  0 siblings, 0 replies; 9+ messages in thread
From: Michal Hocko @ 2016-05-25  6:31 UTC (permalink / raw)
  To: yoma sophian; +Cc: linux-mm

On Wed 25-05-16 10:11:23, yoma sophian wrote:
> >> free-free_cma = 636kB so you are way below the watermark and that is
> > After tracing the __alloc_pages_slowpath, in the 2nd time we call
> > get_page_from_freelist, we will purposely put alloc_flags &
> > ~ALLOC_NO_WATERMARKS.
> > Doesn't that mean kernel will bypass __zone_watermark_ok?
> I apologize for my misunderstanding.
> (alloc_flags & ~ALLOC_NO_WATERMARKS) will NOT bypass __zone_watermark_ok.
> on the contrary, it will filter out watermarks checking.

true

> there is one thing makes me curious,
> why we put  alloc_flags = gfp_to_alloc_flags(gfp_mask) in
> __alloc_pages_slowpath  instead of __alloc_pages_nodemask?

Because we want to make the hot path as effective as possible. So the
hot path is an optimistic attempt with low watermark target which then
falls into the slow path with the full gfp_masks restrictions against
min watermark.

-- 
Michal Hocko
SUSE Labs

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2016-05-25  6:31 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-23  6:47 page order 0 allocation fail but free pages are enough yoma sophian
2016-05-23 14:47 ` Michal Hocko
2016-05-23 15:31   ` yoma sophian
2016-05-23 19:00     ` Michal Hocko
2016-05-24 11:40       ` yoma sophian
2016-05-24 11:50         ` Michal Hocko
2016-05-24 15:06           ` yoma sophian
2016-05-25  2:11             ` yoma sophian
2016-05-25  6:31               ` Michal Hocko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).