From: Minchan Kim <minchan@kernel.org>
To: Mel Gorman <mgorman@suse.de>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>,
Rik van Riel <riel@redhat.com>,
Kamezawa Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
Andrew Morton <akpm@linux-foundation.org>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [RFC 1/2] cma: remove __reclaim_pages
Date: Fri, 17 Aug 2012 10:05:47 +0900 [thread overview]
Message-ID: <20120817010547.GA3061@bbox> (raw)
In-Reply-To: <20120816135817.GS4177@suse.de>
Hi Mel,
On Thu, Aug 16, 2012 at 02:58:18PM +0100, Mel Gorman wrote:
> On Tue, Aug 14, 2012 at 05:57:06PM +0900, Minchan Kim wrote:
> > Now cma reclaims too many pages by __reclaim_pages which says
> > following as
> >
> > * Reclaim enough pages to make sure that contiguous allocation
> > * will not starve the system.
> >
> > Starve? What does it starve the system? The function which allocate
> > free page for migration target would wake up kswapd and do direct reclaim
> > if needed during migration so system doesn't starve.
> >
>
> I thought this patch was overkill at the time it was introduced but
> didn't have a concrete reason to reject it when I commented on it
> https://lkml.org/lkml/2012/1/30/136 . Marek did want this and followed
> up with "contiguous allocations should have higher priority than others"
> which I took to mean that he was also ok with excessive reclaim.
I think OOM kill to background applications is more appropriate than
big latency of foreground(ex, Camera app) application in your mobile phone.
In other words, excessive reclaim is *really* bad which elapsed 8sec
in my test as worst case. :(
>
> > Let remove __reclaim_pages and related function and fields.
> >
>
> That should be one patch and I don't object to it being removed as such
> but it's Marek's call.
Marek. Any thought?
>
> > I modified split_free_page slightly because I removed __reclaim_pages,
> > isolate_freepages_range can fail by split_free_page's watermark check.
> > It's very critical in CMA because it ends up failing alloc_contig_range.
> >
>
> This is a big change and should have been in a patch on its
> own. split_free_page checks watermarks because if the watermarks are
> not obeyed a zone can become fully allocated. This can cause a system to
> livelock under certain circumstances if a page cannot be allocated and a
> free page is required before other pages can be freed.
>
> > I think we don't need the check in case of CMA because CMA allocates
> > free pages by alloc_pages, not isolate_freepages_block in migrate_pages
> > so watermark is already checked in alloc_pages.
>
> It uses alloc_pages when migrating pages out of the CMA area but note
> that it uses isolate_freepages_block when allocating the CMA buffer when
> alloc_contig_range calls isolate_freepages_range
>
> isolate_freepages_range(unsigned long start_pfn, unsigned long end_pfn)
> {
> for (pfn = start_pfn; pfn < end_pfn; pfn += isolated) {
> isolated = isolate_freepages_block(pfn, block_end_pfn,
> &freelist, true);
> }
> map_pages(&freelist);
> }
>
> so the actual CMA allocation itself is not using alloc_pages. By removing
> the watermark check you allow the CMA to breach watermarks and puts the
> system at risk of livelock.
Fair enough. I will look into that.
Thanks, Mel.
--
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>
WARNING: multiple messages have this Message-ID (diff)
From: Minchan Kim <minchan@kernel.org>
To: Mel Gorman <mgorman@suse.de>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>,
Rik van Riel <riel@redhat.com>,
Kamezawa Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
Andrew Morton <akpm@linux-foundation.org>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [RFC 1/2] cma: remove __reclaim_pages
Date: Fri, 17 Aug 2012 10:05:47 +0900 [thread overview]
Message-ID: <20120817010547.GA3061@bbox> (raw)
In-Reply-To: <20120816135817.GS4177@suse.de>
Hi Mel,
On Thu, Aug 16, 2012 at 02:58:18PM +0100, Mel Gorman wrote:
> On Tue, Aug 14, 2012 at 05:57:06PM +0900, Minchan Kim wrote:
> > Now cma reclaims too many pages by __reclaim_pages which says
> > following as
> >
> > * Reclaim enough pages to make sure that contiguous allocation
> > * will not starve the system.
> >
> > Starve? What does it starve the system? The function which allocate
> > free page for migration target would wake up kswapd and do direct reclaim
> > if needed during migration so system doesn't starve.
> >
>
> I thought this patch was overkill at the time it was introduced but
> didn't have a concrete reason to reject it when I commented on it
> https://lkml.org/lkml/2012/1/30/136 . Marek did want this and followed
> up with "contiguous allocations should have higher priority than others"
> which I took to mean that he was also ok with excessive reclaim.
I think OOM kill to background applications is more appropriate than
big latency of foreground(ex, Camera app) application in your mobile phone.
In other words, excessive reclaim is *really* bad which elapsed 8sec
in my test as worst case. :(
>
> > Let remove __reclaim_pages and related function and fields.
> >
>
> That should be one patch and I don't object to it being removed as such
> but it's Marek's call.
Marek. Any thought?
>
> > I modified split_free_page slightly because I removed __reclaim_pages,
> > isolate_freepages_range can fail by split_free_page's watermark check.
> > It's very critical in CMA because it ends up failing alloc_contig_range.
> >
>
> This is a big change and should have been in a patch on its
> own. split_free_page checks watermarks because if the watermarks are
> not obeyed a zone can become fully allocated. This can cause a system to
> livelock under certain circumstances if a page cannot be allocated and a
> free page is required before other pages can be freed.
>
> > I think we don't need the check in case of CMA because CMA allocates
> > free pages by alloc_pages, not isolate_freepages_block in migrate_pages
> > so watermark is already checked in alloc_pages.
>
> It uses alloc_pages when migrating pages out of the CMA area but note
> that it uses isolate_freepages_block when allocating the CMA buffer when
> alloc_contig_range calls isolate_freepages_range
>
> isolate_freepages_range(unsigned long start_pfn, unsigned long end_pfn)
> {
> for (pfn = start_pfn; pfn < end_pfn; pfn += isolated) {
> isolated = isolate_freepages_block(pfn, block_end_pfn,
> &freelist, true);
> }
> map_pages(&freelist);
> }
>
> so the actual CMA allocation itself is not using alloc_pages. By removing
> the watermark check you allow the CMA to breach watermarks and puts the
> system at risk of livelock.
Fair enough. I will look into that.
Thanks, Mel.
--
Kind regards,
Minchan Kim
next prev parent reply other threads:[~2012-08-17 1:05 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-14 8:57 [RFC 0/2] Reduce alloc_contig_range latency Minchan Kim
2012-08-14 8:57 ` Minchan Kim
2012-08-14 8:57 ` [RFC 1/2] cma: remove __reclaim_pages Minchan Kim
2012-08-14 8:57 ` Minchan Kim
2012-08-15 18:49 ` Rik van Riel
2012-08-15 18:49 ` Rik van Riel
2012-08-16 13:58 ` Mel Gorman
2012-08-16 13:58 ` Mel Gorman
2012-08-17 1:05 ` Minchan Kim [this message]
2012-08-17 1:05 ` Minchan Kim
2012-08-17 14:48 ` Marek Szyprowski
2012-08-17 14:48 ` Marek Szyprowski
2012-08-14 8:57 ` [RFC 2/2] cma: support MIGRATE_DISCARD Minchan Kim
2012-08-14 8:57 ` Minchan Kim
2012-08-14 14:19 ` Michal Nazarewicz
2012-08-14 14:19 ` Michal Nazarewicz
2012-08-15 23:20 ` Minchan Kim
2012-08-15 23:20 ` Minchan Kim
2012-08-16 13:17 ` Michal Nazarewicz
2012-08-15 18:58 ` Rik van Riel
2012-08-15 18:58 ` Rik van Riel
2012-08-15 23:33 ` Minchan Kim
2012-08-15 23:33 ` Minchan Kim
2012-08-16 0:15 ` Minchan Kim
2012-08-16 0:15 ` Minchan Kim
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120817010547.GA3061@bbox \
--to=minchan@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=kamezawa.hiroyu@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=m.szyprowski@samsung.com \
--cc=mgorman@suse.de \
--cc=riel@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.