linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Mel Gorman <mel@csn.ul.ie>
To: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Arthur Marsh <arthur.marsh@internode.on.net>,
	Clemens Ladisch <cladisch@googlemail.com>,
	Linux-MM <linux-mm@kvack.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/2] mm: compaction: Minimise the time IRQs are disabled while isolating pages for migration
Date: Mon, 28 Feb 2011 10:18:27 +0000	[thread overview]
Message-ID: <20110228101827.GE9548@csn.ul.ie> (raw)
In-Reply-To: <20110228184230.7c2eefb7.kamezawa.hiroyu@jp.fujitsu.com>

On Mon, Feb 28, 2011 at 06:42:30PM +0900, KAMEZAWA Hiroyuki wrote:
> On Mon, 28 Feb 2011 09:28:14 +0000
> Mel Gorman <mel@csn.ul.ie> wrote:
> 
> > On Mon, Feb 28, 2011 at 02:54:02PM +0900, KAMEZAWA Hiroyuki wrote:
> > > On Mon, 28 Feb 2011 06:48:18 +0100
> > > Andrea Arcangeli <aarcange@redhat.com> wrote:
> > > 
> > > > On Mon, Feb 28, 2011 at 11:17:46AM +0900, KAMEZAWA Hiroyuki wrote:
> > > > > BTW, I forget why we always take zone->lru_lock with IRQ disabled....
> > > > 
> > > > To decrease lock contention in SMP to deliver overall better
> > > > performance (not sure how much it helps though). It was supposed to be
> > > > hold for a very short time (PAGEVEC_SIZE) to avoid giving irq latency
> > > > problems.
> > > > 
> > > 
> > > memory hotplug uses MIGRATE_ISOLATED migrate types for scanning pfn range
> > > without lru_lock. I wonder whether we can make use of it (the function
> > > which memory hotplug may need rework for the compaction but  migrate_type can
> > > be used, I think).
> > > 
> > 
> > I don't see how migrate_type would be of any benefit here particularly
> > as compaction does not directly affect the migratetype of a pageblock. I
> > have not checked closely which part of hotplug you are on about but if
> > you're talking about when pages actually get offlined, the zone lock is
> > not necessary there because the pages are not on the LRU. In compactions
> > case, they are. Did I misunderstand?
> > 
> 
> memory offline code doesn't take big lru_lock (and call isolate_lru_page())
> at picking up migration target pages from LRU.

Right - the scanning doesn't hold the lock but you get and release the lock
for every LRU page encountered. This is fairly expensive but considered ok
during memory hotplug. It's less ideal in compaction which is expected
to be a more frequent operation than memory hotplug.

> While this, allocation from
> the zone is allowed. memory offline is done by mem_section unit.
> 
> memory offline does.
> 
>    1. making a whole section as MIGRATETYPE_ISOLATED.
>    2. scan pfn within section.
>    3. find a page on LRU
>    4. isolate_lru_page() -> take/release lru_lock. ----(*)
>    5. migrate it.
>    6. making all pages in the range as RESERVED.
> 
> During this, by marking the pageblock as MIGRATETYPE_ISOLATED,
> 
>   - new allocation will never picks up a page in the range.

Overkill for compaction though. To use MIGRATE_ISOLATE properly, all pages
on the freelist for that block have to be moved as well. It also operates
at the granularity of a pageblock which is potentially far higher than the
allocation target. It'd might make some sense for transparent hugepage support.

>   - newly freed pages in the range will never be allocated and never in pcp.
>   - page type of the range will never change.
> 
> then, memory offline success.
> 
> If (*) seems too heavy anyway and will be no help even if with some batching
> as isolate_lru_page_pagevec() or some, okay please forget offlining.

(*) is indeed too heavy but if IRQ disabled times are found to be too high
it could be batched like I described in my previous mail. Right now, the
interrupt disabled times are not showing up as very high.

> BTW, can't we drop disable_irq() from all lru_lock related codes ?
> 

I don't think so - at least not right now. Some LRU operations such as LRU
pagevec draining are run from IPI which is running from an interrupt so
minimally spin_lock_irq is necessary.

-- 
Mel Gorman
SUSE Labs

--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2011-02-28 10:18 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-25 20:04 [PATCH 0/2] Reduce the amount of time compaction disables IRQs for V2 Mel Gorman
2011-02-25 20:04 ` [PATCH 1/2] mm: compaction: Minimise the time IRQs are disabled while isolating free pages Mel Gorman
2011-02-25 22:34   ` Johannes Weiner
2011-02-28  1:55   ` KAMEZAWA Hiroyuki
2011-02-28 22:08   ` Minchan Kim
2011-02-25 20:04 ` [PATCH 2/2] mm: compaction: Minimise the time IRQs are disabled while isolating pages for migration Mel Gorman
2011-02-25 22:32   ` Johannes Weiner
2011-02-26  0:16     ` Andrea Arcangeli
2011-02-28  2:17   ` KAMEZAWA Hiroyuki
2011-02-28  5:48     ` Andrea Arcangeli
2011-02-28  5:54       ` KAMEZAWA Hiroyuki
2011-02-28  9:28         ` Mel Gorman
2011-02-28  9:42           ` KAMEZAWA Hiroyuki
2011-02-28 10:18             ` Mel Gorman [this message]
2011-02-28 23:42               ` KAMEZAWA Hiroyuki
2011-03-01  4:11                 ` Minchan Kim
2011-03-01  4:49                   ` KAMEZAWA Hiroyuki
2011-02-28 23:01   ` Minchan Kim
2011-02-28 23:07     ` Andrea Arcangeli
2011-02-28 23:25       ` Minchan Kim
2011-03-01 22:15   ` Andrew Morton
2011-02-25 20:07 ` [PATCH 0/2] Reduce the amount of time compaction disables IRQs for V2 Andrea Arcangeli
  -- strict thread matches above, loose matches on Subject: below --
2011-03-01 15:35 [PATCH 2/2] mm: compaction: Minimise the time IRQs are disabled while isolating pages for migration Minchan Kim
2011-03-01 16:19 ` Andrea Arcangeli
2011-03-01 22:22   ` Minchan Kim
2011-03-01 22:34     ` Andrew Morton
2011-03-01 22:57       ` Minchan Kim
2011-02-25 18:00 [PATCH 0/2] Reduce the amount of time compaction disables IRQs for Mel Gorman
2011-02-25 18:00 ` [PATCH 2/2] mm: compaction: Minimise the time IRQs are disabled while isolating pages for migration Mel Gorman

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=20110228101827.GE9548@csn.ul.ie \
    --to=mel@csn.ul.ie \
    --cc=aarcange@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=arthur.marsh@internode.on.net \
    --cc=cladisch@googlemail.com \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).