* CMA and zone watermarks @ 2012-10-08 15:41 Rabin Vincent 2012-10-09 0:37 ` Marek Szyprowski 2012-10-09 3:10 ` Minchan Kim 0 siblings, 2 replies; 9+ messages in thread From: Rabin Vincent @ 2012-10-08 15:41 UTC (permalink / raw) To: Marek Szyprowski; +Cc: linux-mm, LKML [-- Attachment #1: Type: text/plain, Size: 1235 bytes --] It appears that when CMA is enabled, the zone watermarks are not properly respected, leading to for example GFP_NOWAIT allocations getting access to the high pools. I ran the following test code which simply allocates pages with GFP_NOWAIT until it fails, and then tries GFP_ATOMIC. Without CMA, the GFP_ATOMIC allocation succeeds, with CMA, it fails too. Logs attached (includes my patch which prints the migration type in the failure message http://marc.info/?l=linux-mm&m=134971041701306&w=2), taken on 3.6 kernel. Thanks. diff --git a/arch/arm/mach-ux500/board-mop500.c b/arch/arm/mach-ux500/board-mop500.c index a534d88..b98d0df 100644 --- a/arch/arm/mach-ux500/board-mop500.c +++ b/arch/arm/mach-ux500/board-mop500.c @@ -854,3 +854,25 @@ DT_MACHINE_START(U8500_DT, "ST-Ericsson U8500 platform (Device Tree Support)") .dt_compat = u8500_dt_board_compat, MACHINE_END #endif + +static int __init late(void) +{ + while (1) { + void *p; + + p = alloc_page(GFP_NOWAIT); + if (!p) { + pr_err("GFP_NOWAIT failed, checking GFP_ATOMIC"); + + p = alloc_page(GFP_ATOMIC); + if (!p) + panic("GFP_ATOMIC failed too, fail!"); + + panic("GFP_ATOMIC OK, all good\n"); + } + + } + + return 0; +} +late_initcall(late); [-- Attachment #2: cmalog.txt.gz --] [-- Type: application/x-gzip, Size: 6122 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: CMA and zone watermarks 2012-10-08 15:41 CMA and zone watermarks Rabin Vincent @ 2012-10-09 0:37 ` Marek Szyprowski 2012-10-09 15:25 ` Rabin Vincent 2012-10-09 3:10 ` Minchan Kim 1 sibling, 1 reply; 9+ messages in thread From: Marek Szyprowski @ 2012-10-09 0:37 UTC (permalink / raw) To: Rabin Vincent; +Cc: linux-mm, LKML Hello, On 10/8/2012 5:41 PM, Rabin Vincent wrote: > It appears that when CMA is enabled, the zone watermarks are not properly > respected, leading to for example GFP_NOWAIT allocations getting access to the > high pools. > > I ran the following test code which simply allocates pages with GFP_NOWAIT > until it fails, and then tries GFP_ATOMIC. Without CMA, the GFP_ATOMIC > allocation succeeds, with CMA, it fails too. Could You run your test with latest linux-next kernel? There have been some patches merged to akpm tree which should fix accounting for free and free cma pages. I hope it should fix this issue. Best regards -- Marek Szyprowski Samsung Poland R&D Center -- 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: CMA and zone watermarks 2012-10-09 0:37 ` Marek Szyprowski @ 2012-10-09 15:25 ` Rabin Vincent 0 siblings, 0 replies; 9+ messages in thread From: Rabin Vincent @ 2012-10-09 15:25 UTC (permalink / raw) To: Marek Szyprowski, Minchan Kim; +Cc: linux-mm, LKML Hi Marek, Minchan, 2012/10/9 Marek Szyprowski <m.szyprowski@samsung.com>: > Could You run your test with latest linux-next kernel? There have been some > patches merged to akpm tree which should fix accounting for free and free > cma pages. I hope it should fix this issue. I've tested with the mentioned patches (which seem to have also reached Linus' tree today) and they appear to resolve the problem. Thanks. -- 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: CMA and zone watermarks 2012-10-08 15:41 CMA and zone watermarks Rabin Vincent 2012-10-09 0:37 ` Marek Szyprowski @ 2012-10-09 3:10 ` Minchan Kim 2012-10-09 3:12 ` Marek Szyprowski 1 sibling, 1 reply; 9+ messages in thread From: Minchan Kim @ 2012-10-09 3:10 UTC (permalink / raw) To: Rabin Vincent; +Cc: Marek Szyprowski, linux-mm, LKML Hello, On Mon, Oct 08, 2012 at 05:41:14PM +0200, Rabin Vincent wrote: > It appears that when CMA is enabled, the zone watermarks are not properly > respected, leading to for example GFP_NOWAIT allocations getting access to the > high pools. > > I ran the following test code which simply allocates pages with GFP_NOWAIT > until it fails, and then tries GFP_ATOMIC. Without CMA, the GFP_ATOMIC > allocation succeeds, with CMA, it fails too. Good spot. By wrong zone_watermark_check, it can consume reserved memory pool. > > Logs attached (includes my patch which prints the migration type in the failure > message http://marc.info/?l=linux-mm&m=134971041701306&w=2), taken on 3.6 > kernel. > Fortunately, recently, Bart sent a patch about that. http://marc.info/?l=linux-mm&m=134763299016693&w=2 Could you test above patches in your kernel? You have to apply [2/4], [3/4], [4/4] and don't need [1/4]. Thanks. -- Kind regards, Minchan Kim -- 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: CMA and zone watermarks 2012-10-09 3:10 ` Minchan Kim @ 2012-10-09 3:12 ` Marek Szyprowski 2012-10-09 4:43 ` Minchan Kim 0 siblings, 1 reply; 9+ messages in thread From: Marek Szyprowski @ 2012-10-09 3:12 UTC (permalink / raw) To: Minchan Kim; +Cc: Rabin Vincent, linux-mm, LKML Hello, On 10/9/2012 5:10 AM, Minchan Kim wrote: > On Mon, Oct 08, 2012 at 05:41:14PM +0200, Rabin Vincent wrote: >> It appears that when CMA is enabled, the zone watermarks are not properly >> respected, leading to for example GFP_NOWAIT allocations getting access to the >> high pools. >> >> I ran the following test code which simply allocates pages with GFP_NOWAIT >> until it fails, and then tries GFP_ATOMIC. Without CMA, the GFP_ATOMIC >> allocation succeeds, with CMA, it fails too. > > Good spot. By wrong zone_watermark_check, it can consume reserved memory pool. That was the main reason for the Bartek's research. >> Logs attached (includes my patch which prints the migration type in the failure >> message http://marc.info/?l=linux-mm&m=134971041701306&w=2), taken on 3.6 >> kernel. >> > > Fortunately, recently, Bart sent a patch about that. > http://marc.info/?l=linux-mm&m=134763299016693&w=2 > > Could you test above patches in your kernel? > You have to apply [2/4], [3/4], [4/4] and don't need [1/4]. AFAIR without patch [1/4], free cma page counter will go below zero and weird thing will happen, so better apply the complete patchset. Best regards -- Marek Szyprowski Samsung Poland R&D Center -- 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: CMA and zone watermarks 2012-10-09 3:12 ` Marek Szyprowski @ 2012-10-09 4:43 ` Minchan Kim 2012-10-09 4:53 ` Marek Szyprowski 0 siblings, 1 reply; 9+ messages in thread From: Minchan Kim @ 2012-10-09 4:43 UTC (permalink / raw) To: Marek Szyprowski; +Cc: Rabin Vincent, linux-mm, LKML On Tue, Oct 09, 2012 at 05:12:21AM +0200, Marek Szyprowski wrote: > Hello, > > On 10/9/2012 5:10 AM, Minchan Kim wrote: > > >On Mon, Oct 08, 2012 at 05:41:14PM +0200, Rabin Vincent wrote: > >>It appears that when CMA is enabled, the zone watermarks are not properly > >>respected, leading to for example GFP_NOWAIT allocations getting access to the > >>high pools. > >> > >>I ran the following test code which simply allocates pages with GFP_NOWAIT > >>until it fails, and then tries GFP_ATOMIC. Without CMA, the GFP_ATOMIC > >>allocation succeeds, with CMA, it fails too. > > > >Good spot. By wrong zone_watermark_check, it can consume reserved memory pool. > > That was the main reason for the Bartek's research. Okay. It shoud have written down for more good description at that time. :) > > >>Logs attached (includes my patch which prints the migration type in the failure > >>message http://marc.info/?l=linux-mm&m=134971041701306&w=2), taken on 3.6 > >>kernel. > >> > > > >Fortunately, recently, Bart sent a patch about that. > >http://marc.info/?l=linux-mm&m=134763299016693&w=2 > > > >Could you test above patches in your kernel? > >You have to apply [2/4], [3/4], [4/4] and don't need [1/4]. > > AFAIR without patch [1/4], free cma page counter will go below zero > and weird thing will happen, so better apply the complete patchset. I can't understand your point. [1/4] is just fix for correcting trace No? http://marc.info/?l=linux-mm&m=134763301216713&w=2 > > Best regards > -- > Marek Szyprowski > Samsung Poland R&D Center > > -- > 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> -- Kind regards, Minchan Kim -- 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: CMA and zone watermarks 2012-10-09 4:43 ` Minchan Kim @ 2012-10-09 4:53 ` Marek Szyprowski 2012-10-09 5:07 ` Minchan Kim 0 siblings, 1 reply; 9+ messages in thread From: Marek Szyprowski @ 2012-10-09 4:53 UTC (permalink / raw) To: Minchan Kim; +Cc: Rabin Vincent, linux-mm, LKML Hello, On 10/9/2012 6:43 AM, Minchan Kim wrote: > On Tue, Oct 09, 2012 at 05:12:21AM +0200, Marek Szyprowski wrote: >> On 10/9/2012 5:10 AM, Minchan Kim wrote: >>> On Mon, Oct 08, 2012 at 05:41:14PM +0200, Rabin Vincent wrote: >>> Fortunately, recently, Bart sent a patch about that. >>> http://marc.info/?l=linux-mm&m=134763299016693&w=2 >>> >>> Could you test above patches in your kernel? >>> You have to apply [2/4], [3/4], [4/4] and don't need [1/4]. >> >> AFAIR without patch [1/4], free cma page counter will go below zero >> and weird thing will happen, so better apply the complete patchset. > > I can't understand your point. [1/4] is just fix for correcting trace > No? I just remember we ran into such strange negative number of free cma pages issue without that patch, but maybe the final patchset will simply fail to apply without the first patch. Best regards -- Marek Szyprowski Samsung Poland R&D Center -- 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: CMA and zone watermarks 2012-10-09 4:53 ` Marek Szyprowski @ 2012-10-09 5:07 ` Minchan Kim 2012-10-09 5:16 ` Marek Szyprowski 0 siblings, 1 reply; 9+ messages in thread From: Minchan Kim @ 2012-10-09 5:07 UTC (permalink / raw) To: Marek Szyprowski; +Cc: Rabin Vincent, linux-mm, LKML On Tue, Oct 09, 2012 at 06:53:29AM +0200, Marek Szyprowski wrote: > Hello, > > On 10/9/2012 6:43 AM, Minchan Kim wrote: > >On Tue, Oct 09, 2012 at 05:12:21AM +0200, Marek Szyprowski wrote: > >>On 10/9/2012 5:10 AM, Minchan Kim wrote: > >>>On Mon, Oct 08, 2012 at 05:41:14PM +0200, Rabin Vincent wrote: > > >>>Fortunately, recently, Bart sent a patch about that. > >>>http://marc.info/?l=linux-mm&m=134763299016693&w=2 > >>> > >>>Could you test above patches in your kernel? > >>>You have to apply [2/4], [3/4], [4/4] and don't need [1/4]. > >> > >>AFAIR without patch [1/4], free cma page counter will go below zero > >>and weird thing will happen, so better apply the complete patchset. > > > >I can't understand your point. [1/4] is just fix for correcting trace > >No? > > I just remember we ran into such strange negative number of free cma > pages issue without that patch, but maybe the final patchset will > simply fail to apply without the first patch. I have no objection to apply them all, of course. But note that if you suffer from such strange bug without [1/4], it should be dug in without buring into just "fixing of the trace" comment. As I saw the code without [1/4], I can't find any fault. Could you elaborat it more if you have any guessing in mind? > > Best regards > -- > Marek Szyprowski > Samsung Poland R&D Center > > -- > 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> -- Kind regards, Minchan Kim -- 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: CMA and zone watermarks 2012-10-09 5:07 ` Minchan Kim @ 2012-10-09 5:16 ` Marek Szyprowski 0 siblings, 0 replies; 9+ messages in thread From: Marek Szyprowski @ 2012-10-09 5:16 UTC (permalink / raw) To: Minchan Kim; +Cc: Rabin Vincent, linux-mm, LKML Hello, On 10/9/2012 7:07 AM, Minchan Kim wrote: > On Tue, Oct 09, 2012 at 06:53:29AM +0200, Marek Szyprowski wrote: >> Hello, >> >> On 10/9/2012 6:43 AM, Minchan Kim wrote: >>> On Tue, Oct 09, 2012 at 05:12:21AM +0200, Marek Szyprowski wrote: >>>> On 10/9/2012 5:10 AM, Minchan Kim wrote: >>>>> On Mon, Oct 08, 2012 at 05:41:14PM +0200, Rabin Vincent wrote: >> >>>>> Fortunately, recently, Bart sent a patch about that. >>>>> http://marc.info/?l=linux-mm&m=134763299016693&w=2 >>>>> >>>>> Could you test above patches in your kernel? >>>>> You have to apply [2/4], [3/4], [4/4] and don't need [1/4]. >>>> >>>> AFAIR without patch [1/4], free cma page counter will go below zero >>>> and weird thing will happen, so better apply the complete patchset. >>> >>> I can't understand your point. [1/4] is just fix for correcting trace >>> No? >> >> I just remember we ran into such strange negative number of free cma >> pages issue without that patch, but maybe the final patchset will >> simply fail to apply without the first patch. > > I have no objection to apply them all, of course. > But note that if you suffer from such strange bug without [1/4], > it should be dug in without buring into just "fixing of the trace" > comment. As I saw the code without [1/4], I can't find any fault. > Could you elaborate it more if you have any guessing in mind? I remember that in one version of the Bartek's patches, page_private(page) has been used directly for getting the migratetype after a call to __free_one_page() (the same way as trace_mm_page_pcpu_drain() used it), what resulted in incorrect counting of free pages. The issue has been fixed then by the patch [1/4]. Now I've check that the next patches use mt variable instead of page_private(page), so they will simply not apply without [1/4]. No other issues should be expected. I'm sorry for confusion. Best regards -- Marek Szyprowski Samsung Poland R&D Center -- 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:[~2012-10-09 15:25 UTC | newest] Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2012-10-08 15:41 CMA and zone watermarks Rabin Vincent 2012-10-09 0:37 ` Marek Szyprowski 2012-10-09 15:25 ` Rabin Vincent 2012-10-09 3:10 ` Minchan Kim 2012-10-09 3:12 ` Marek Szyprowski 2012-10-09 4:43 ` Minchan Kim 2012-10-09 4:53 ` Marek Szyprowski 2012-10-09 5:07 ` Minchan Kim 2012-10-09 5:16 ` Marek Szyprowski
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox