Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1451832

Re: [RFC] can we use vmalloc to alloc thread stack if compaction failed

From Xishi Qiu <qiuxishi@huawei.com>
Newsgroups linux.kernel
Subject Re: [RFC] can we use vmalloc to alloc thread stack if compaction failed
Date 2016-07-28 11:40 +0200
Message-ID <rZPXj-4m8-23@gated-at.bofh.it> (permalink)
References <rZNLP-2UX-7@gated-at.bofh.it> <rZNVv-2YL-1@gated-at.bofh.it> <rZOoy-39Z-21@gated-at.bofh.it> <rZOoy-39Z-19@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 2016/7/28 15:58, Michal Hocko wrote:

> On Thu 28-07-16 15:41:53, Xishi Qiu wrote:
>> On 2016/7/28 15:20, Michal Hocko wrote:
>>
>>> On Thu 28-07-16 15:08:26, Xishi Qiu wrote:
>>>> Usually THREAD_SIZE_ORDER is 2, it means we need to alloc 16kb continuous
>>>> physical memory during fork a new process.
>>>>
>>>> If the system's memory is very small, especially the smart phone, maybe there
>>>> is only 1G memory. So the free memory is very small and compaction is not
>>>> always success in slowpath(__alloc_pages_slowpath), then alloc thread stack
>>>> may be failed for memory fragment.
>>>
>>> Well, with the current implementation of the page allocator those
>>> requests will not fail in most cases. The oom killer would be invoked in
>>> order to free up some memory.
>>>
>>
>> Hi Michal,
>>
>> Yes, it success in most cases, but I did have seen this problem in some
>> stress-test.
>>
>> DMA free:470628kB, but alloc 2 order block failed during fork a new process.
>> There are so many memory fragments and the large block may be soon taken by
>> others after compact because of stress-test.
>>
>> --- dmesg messages ---
>> 07-13 08:41:51.341 <4>[309805.658142s][pid:1361,cpu5,sManagerService]sManagerService: page allocation failure: order:2, mode:0x2000d1
> 
> Yes but this is __GFP_DMA allocation. I guess you have already reported
> this failure and you've been told that this is quite unexpected for the
> kernel stack allocation. It is your out-of-tree patch which just makes
> things worse because DMA restricted allocations are considered "lowmem"
> and so they do not invoke OOM killer and do not retry like regular
> GFP_KERNEL allocations.

Hi Michal,

Yes, we add GFP_DMA, but I don't think this is the key for the problem.

If we do oom-killer, maybe we will get a large block later, but there
is enough free memory before oom(although most of them are fragments).

I wonder if we can alloc success without kill any process in this situation.
Maybe use vmalloc is a good way, but I don't know the influence.

Thanks,
Xishi Qiu

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC] can we use vmalloc to alloc thread stack if compaction failed Xishi Qiu <qiuxishi@huawei.com> - 2016-07-28 09:20 +0200
  Re: [RFC] can we use vmalloc to alloc thread stack if compaction  failed Michal Hocko <mhocko@kernel.org> - 2016-07-28 09:30 +0200
    Re: [RFC] can we use vmalloc to alloc thread stack if compaction  failed Michal Hocko <mhocko@kernel.org> - 2016-07-28 10:00 +0200
      Re: [RFC] can we use vmalloc to alloc thread stack if compaction  failed Xishi Qiu <qiuxishi@huawei.com> - 2016-07-28 11:40 +0200
        Re: [RFC] can we use vmalloc to alloc thread stack if compaction  failed Michal Hocko <mhocko@kernel.org> - 2016-07-28 11:50 +0200
          Re: [RFC] can we use vmalloc to alloc thread stack if compaction  failed Xishi Qiu <qiuxishi@huawei.com> - 2016-07-28 14:10 +0200
            Re: [RFC] can we use vmalloc to alloc thread stack if compaction failed Andy Lutomirski <luto@kernel.org> - 2016-07-28 17:10 +0200
              Re: [RFC] can we use vmalloc to alloc thread stack if compaction  failed Joonsoo Kim <iamjoonsoo.kim@lge.com> - 2016-07-29 05:00 +0200
                Re: [RFC] can we use vmalloc to alloc thread stack if compaction failed Andy Lutomirski <luto@amacapital.net> - 2016-07-29 21:50 +0200
                Re: [RFC] can we use vmalloc to alloc thread stack if compaction  failed Joonsoo Kim <iamjoonsoo.kim@lge.com> - 2016-08-01 07:50 +0200
                Re: [RFC] can we use vmalloc to alloc thread stack if compaction failed Andy Lutomirski <luto@amacapital.net> - 2016-08-10 21:10 +0200
    Re: [RFC] can we use vmalloc to alloc thread stack if compaction  failed Xishi Qiu <qiuxishi@huawei.com> - 2016-07-28 10:00 +0200

csiph-web