>On Fri 30-08-19 18:25:53, Sangwoo wrote:
>> The highatomic migrate block can be increased to 1% of Total memory.
>> And, this is for only highorder ( > 0 order). So, this block size is
>> excepted during check watermark if allocation type isn't alloc_harder.
>>
>> It has problem. The usage of highatomic is already calculated at NR_FREE_PAGES.
>> So, if we except total block size of highatomic, it's twice minus size of allocated
>> highatomic.
>> It's cause allocation fail although free pages enough.
>>
>> We checked this by random test on my target(8GB RAM).
>>
>> Binder:6218_2: page allocation failure: order:0, mode:0x14200ca(GFP_HIGHUSER_MOVABLE), nodemask=(null)
>> Binder:6218_2 cpuset=background mems_allowed=0
>
>How come this order-0 sleepable allocation fails? The upstream kernel
>doesn't fail those allocations unless the process context is killed by
>the oom killer.
Most calltacks are zsmalloc, as shown below.
Call trace:
dump_backtrace+0x0/0x1f0
show_stack+0x18/0x20
dump_stack+0xc4/0x100
warn_alloc+0x100/0x198
__alloc_pages_nodemask+0x116c/0x1188
do_swap_page+0x10c/0x6f0
handle_pte_fault+0x12c/0xfe0
handle_mm_fault+0x1d0/0x328
do_page_fault+0x2a0/0x3e0
do_translation_fault+0x44/0xa8
do_mem_abort+0x4c/0xd0
el1_da+0x24/0x84
__arch_copy_to_user+0x5c/0x220
binder_ioctl+0x20c/0x740
compat_SyS_ioctl+0x128/0x248
__sys_trace_return+0x0/0x4
>
>Also please note that atomic reserves are released when the memory
>pressure is high and we cannot reclaim any other memory. Have a look at
>unreserve_highatomic_pageblock called from should_reclaim_retry.
I know what you said. However, what I mentioned is not the efficiency of that highatomic block,
this is to reduce allocation fail through more accurate watermark calculation using
the remaining pages of highatomic for non-atomic allocation.
(Of course even if watermark is correct after should_reclaim_retry(),
In the case of PF_MEMALLOC and __GFP_NORETRY, it will fail despite being able to allocate free pages.)
In other words, I thought it would be right to subtract the remaining free amount
of highatomic from the highatomic page. In the same test, allocation failure is reduced.
Test environment:
- Board: SDM450, 4GB RAM,
- Platform: Android P Os
Test method:
- 60 apps installed
- Same pattern test script.
Result:
- before: 76 page allocation fail
- after: zero
Thanks
Sangwoo