Dear Joonsoo,
I tried your changes which are present at the below link. https://github.com/JoonsooKim/linux/tree/cma-fix-up-v3.0-next-20140625 But unfortunately for me it did not help much. After running various apps that uses ION nonmovable memory, it fails to allocate memory after some time. When I see the pagetypeinfo shows lots of CMA pages available and non-movable were very less and thus nonmovable allocation were failing. However I noticed the failure was little delayed. Also I noticed that the CMA utilized and the CMA free is not matching with total CMA size.
In my system RAM is 256MB and CMA configured is 56MB. And free memory was hanging around 30-40MB during failure.
Am I missing something? My kernel version is 3.10 and I applied the changes manually. If there are other sets of patches that needs to be applied, please let me know. Note, I did not apply the ALLOC_CMA removal patches.
Now I am experimenting more and will share if I have any findings.
Thank you! Pintu
Sent from Samsung Mobile
-------- Original message -------- From: Joonsoo Kim iamjoonsoo.kim@lge.com Date: 29/07/2014 5:06 PM (GMT+09:00) To: 'pintu_agarwal' pintu_agarwal@yahoo.com,linux-mm@kvack.org,linux-arm-kernel@lists.infradead.org,linaro-mm-sig@lists.linaro.org,ritesh.list@gmail.com Cc: pintu.k@outlook.com,pintu.k@samsung.com,vishu_1385@yahoo.com,m.szyprowski@samsung.com,mina86@mina86.com,ngupta@vflare.org,iqbalblr@gmail.com Subject: RE: [linux-3.10.17] Could not allocate memory from free CMA areas
From: pintu_agarwal [mailto:pintu_agarwal@yahoo.com] Sent: Friday, July 25, 2014 12:15 AM To: PINTU KUMAR; linux-mm@kvack.org; linux-arm-kernel@lists.infradead.org; linaro-mm-sig@lists.linaro.org; iamjoonsoo.kim@lge.com; ritesh.list@gmail.com Cc: pintu.k@outlook.com; pintu.k@samsung.com; vishu_1385@yahoo.com; m.szyprowski@samsung.com; mina86@mina86.com; ngupta@vflare.org; iqbalblr@gmail.com Subject: RE: [linux-3.10.17] Could not allocate memory from free CMA areas
Dear joonsoo kim,
I have your patches for: Aggressively allocate memory from cma .... We are facing almost similar problem here. If any of your patches still working for you please let us know here. I would like to try those approach.
Hello,
I stopped to implement it, because there are other bugs on CMA related codes. Although aggressively allocate... doesn't have bugs itself, it enlarges existing freepage counting bugs significantly so I'm first trying to fix those bugs. See the below link.
https://lkml.org/lkml/2014/7/4/79
I will restart to implement aggressively... after fixing these bugs.
If you have interest on next version of aggressively allocate..., see the following link.
https://github.com/JoonsooKim/linux/tree/cma-fix-up-v3.0-next-20140625
Thanks.
Dear Joonsoo,
I tried your changes which are present at the below link. https://github.com/JoonsooKim/linux/tree/cma-fix-up-v3.0-next-20140625 But unfortunately for me it did not help much. After running various apps that uses ION nonmovable memory, it fails to allocate memory after some time. When I see the pagetypeinfo shows lots of CMA pages available and non-movable were very less and thus nonmovable allocation were failing.
Okay. CMA pages cannot be used for nonmovable memory, so it can fail in above case.
However I noticed the failure was little delayed.
It is good sign. I guess that there is movable/CMA ratio problem. My patchset uses free CMA pages in certain ratio to free movable page consumption. If your system doesn't use movable page sufficiently, free CMA pages cannot be used fully. Could you test with following workaround?
+ if (normal > cma) { + zone->max_try_normal = pageblock_nr_pages; + zone->max_try_cma = pageblock_nr_pages; + } else { + zone->max_try_normal = pageblock_nr_pages; + zone->max_try_cma = pageblock_nr_pages; + }
Thanks.
Hello,
From: iamjoonsoo.kim@lge.com To: pintu_agarwal@yahoo.com; linux-mm@kvack.org; linux-arm-kernel@lists.infradead.org; linaro-mm-sig@lists.linaro.org; ritesh.list@gmail.com CC: pintu.k@outlook.com; pintu.k@samsung.com; vishu_1385@yahoo.com; m.szyprowski@samsung.com; mina86@mina86.com; ngupta@vflare.org; iqbalblr@gmail.com Subject: RE: [linux-3.10.17] Could not allocate memory from free CMA areas Date: Mon, 4 Aug 2014 16:11:00 +0900
Dear Joonsoo,
I tried your changes which are present at the below link. https://github.com/JoonsooKim/linux/tree/cma-fix-up-v3.0-next-20140625 But unfortunately for me it did not help much. After running various apps that uses ION nonmovable memory, it fails to allocate memory after some time. When I see the pagetypeinfo shows lots of CMA pages available and non-movable were very less and thus nonmovable allocation were failing.
Okay. CMA pages cannot be used for nonmovable memory, so it can fail in above case.
However I noticed the failure was little delayed.
It is good sign. I guess that there is movable/CMA ratio problem. My patchset uses free CMA pages in certain ratio to free movable page consumption. If your system doesn't use movable page sufficiently, free CMA pages cannot be used fully. Could you test with following workaround?
if (normal> cma) {
zone->max_try_normal = pageblock_nr_pages;
zone->max_try_cma = pageblock_nr_pages;
} else {
zone->max_try_normal = pageblock_nr_pages;
zone->max_try_cma = pageblock_nr_pages;
}
I applied these changes but still the allocations are failing because there are no non-movable memory left in the system. With the changes I noticed that nr_cma_free sometimes becomes almost zero. But in our case Display/Xorg needs to have atleast 8MB of CMA (contiguous) memory of order-8 and order-4 type. CMA:56MB is shared across display,camera,video etc.
I think the previous changes are slightly better.
My concern is that whether I am applying all you changes or missing some thing. I saw that your kernel version is based on next-20140625 but my kernel version is 3.10.17. And till now I applied only the below changes: https://github.com/JoonsooKim/linux/commit/33a0416b3ac1cd7c88e6b35ee61b4a81a...
But I haven't applied this: https://github.com/JoonsooKim/linux/commit/166b4186d101b190cf50195d841e2189f... (CMA: always treat free cma pages as non-free on watermark checking) These changes have other dependencies which is not present in my kernel version. Like inclusion of ALLOC_FAIR and area->nr_cma_free. Please let me know if these changes are also important for "aggressive alloc changes..."
If possible please send me all the patches related to "aggressive cma.." so that I can conclude on my experiment.
Further I will share the experimental result from my side.
Thanks.
On Tue, Aug 05, 2014 at 08:24:50PM +0530, Pintu Kumar wrote:
Hello,
From: iamjoonsoo.kim@lge.com To: pintu_agarwal@yahoo.com; linux-mm@kvack.org; linux-arm-kernel@lists.infradead.org; linaro-mm-sig@lists.linaro.org; ritesh.list@gmail.com CC: pintu.k@outlook.com; pintu.k@samsung.com; vishu_1385@yahoo.com; m.szyprowski@samsung.com; mina86@mina86.com; ngupta@vflare.org; iqbalblr@gmail.com Subject: RE: [linux-3.10.17] Could not allocate memory from free CMA areas Date: Mon, 4 Aug 2014 16:11:00 +0900
Dear Joonsoo,
I tried your changes which are present at the below link. https://github.com/JoonsooKim/linux/tree/cma-fix-up-v3.0-next-20140625 But unfortunately for me it did not help much. After running various apps that uses ION nonmovable memory, it fails to allocate memory after some time. When I see the pagetypeinfo shows lots of CMA pages available and non-movable were very less and thus nonmovable allocation were failing.
Okay. CMA pages cannot be used for nonmovable memory, so it can fail in above case.
However I noticed the failure was little delayed.
It is good sign. I guess that there is movable/CMA ratio problem. My patchset uses free CMA pages in certain ratio to free movable page consumption. If your system doesn't use movable page sufficiently, free CMA pages cannot be used fully. Could you test with following workaround?
if (normal> cma) {
zone->max_try_normal = pageblock_nr_pages;
zone->max_try_cma = pageblock_nr_pages;
} else {
zone->max_try_normal = pageblock_nr_pages;
zone->max_try_cma = pageblock_nr_pages;
}
I applied these changes but still the allocations are failing because there are no non-movable memory left in the system.
Hello,
kswapd doesn't work? Please let me know your problem in detail.
With the changes I noticed that nr_cma_free sometimes becomes almost zero. But in our case Display/Xorg needs to have atleast 8MB of CMA (contiguous) memory of order-8 and order-4 type. CMA:56MB is shared across display,camera,video etc.
Used CMA pages will be released automatically when your Display/Xorg request them. So you don't need to worry about empty of free CMA pages.
I think the previous changes are slightly better.
My concern is that whether I am applying all you changes or missing some thing. I saw that your kernel version is based on next-20140625 but my kernel version is 3.10.17. And till now I applied only the below changes: https://github.com/JoonsooKim/linux/commit/33a0416b3ac1cd7c88e6b35ee61b4a81a...
But I haven't applied this: https://github.com/JoonsooKim/linux/commit/166b4186d101b190cf50195d841e2189f... (CMA: always treat free cma pages as non-free on watermark checking)
This patch is somewhat related to your failure of non-movable memory allocation. It is simple so that you can easily backport.
These changes have other dependencies which is not present in my kernel version. Like inclusion of ALLOC_FAIR and area->nr_cma_free. Please let me know if these changes are also important for "aggressive alloc changes..."
If possible please send me all the patches related to "aggressive cma.." so that I can conclude on my experiment.
Until now, that's all. :)
Thanks.
linaro-mm-sig@lists.linaro.org