All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Minchan Kim <minchan.kim@gmail.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
	Mel Gorman <mel@csn.ul.ie>,
	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: Tue, 1 Mar 2011 14:34:44 -0800	[thread overview]
Message-ID: <20110301143444.2ed102aa.akpm@linux-foundation.org> (raw)
In-Reply-To: <AANLkTimpTyaAU0JzFKp4s14w=ciq152MWSmbgn8xtkOx@mail.gmail.com>

On Wed, 2 Mar 2011 07:22:33 +0900
Minchan Kim <minchan.kim@gmail.com> wrote:

> On Wed, Mar 2, 2011 at 1:19 AM, Andrea Arcangeli <aarcange@redhat.com> wrote:
> > On Wed, Mar 02, 2011 at 12:35:58AM +0900, Minchan Kim wrote:
> >> On Tue, Mar 01, 2011 at 01:49:25PM +0900, KAMEZAWA Hiroyuki wrote:
> >> > On Tue, 1 Mar 2011 13:11:46 +0900
> >> > Minchan Kim <minchan.kim@gmail.com> wrote:
> >> >
>
> ...
>
> > pages freed from irq shouldn't be PageLRU.
> 
> Hmm..
> As looking code, it seems to be no problem and I didn't see the any
> comment about such rule. It should have been written down in
> __page_cache_release.
> Just out of curiosity.
> What kinds of problem happen if we release lru page in irq context?

put_page() from irq context has been permissible for ten years.  I
expect there are a number of sites which do this (via subtle code
paths, often).  It might get messy.

> >
> > deferring freeing to workqueue doesn't look ok. firewall loads runs
> > only from irq and this will cause some more work and a delay in the
> > freeing. I doubt it's worhwhile especially for the lru_lock.
> >
> 
> As you said, if it is for decreasing lock contention in SMP to deliver
> overall better performance, maybe we need to check again how much it
> helps.
> If it doesn't help much, could we remove irq_save/restore of lru_lock?
> Do you know any benchmark to prove it had a benefit at that time or
> any thread discussing about that in lkml?


: commit b10a82b195d63575958872de5721008b0e9bef2d
: Author: akpm <akpm>
: Date:   Thu Aug 15 18:21:05 2002 +0000
: 
:     [PATCH] make pagemap_lru_lock irq-safe
:     
:     It is expensive for a CPU to take an interrupt while holding the page
:     LRU lock, because other CPUs will pile up on the lock while the
:     interrupt runs.
:     
:     Disabling interrupts while holding the lock reduces contention by an
:     additional 30% on 4-way.  This is when the only source of interrupts is
:     disk completion.  The improvement will be higher with more CPUs and it
:     will be higher if there is networking happening.
:     
:     The maximum hold time of this lock is 17 microseconds on 500 MHx PIII,
:     which is well inside the kernel's maximum interrupt latency (which was
:     100 usecs when I last looked, a year ago).
:     
:     This optimisation is not needed on uniprocessor, but the patch disables
:     IRQs while holding pagemap_lru_lock anyway, so it becomes an irq-safe
:     spinlock, and pages can be moved from the LRU in interrupt context.
:     
:     pagemap_lru_lock has been renamed to _pagemap_lru_lock to pick up any
:     missed uses, and to reliably break any out-of-tree patches which may be
:     using the old semantics.
:     
:     BKrev: 3d5bf1110yfdAAur4xqJfiLBDJ2Cqw


Ancient stuff, and not a lot of detail.  But I did measure it.  I
measured everything ;) And, as mentioned, I'd expect that the
contention problems would worsen on higher CPU machines and higher
interrupt frequencies.

I expect we could eliminate the irqsave requirement from
rotate_reclaimable_page() simply by switching to a trylock.  Some pages
will end up at the wrong end of the LRU but the effects may be
negligible.  Or perhaps they may not - disk seeks are costly.


WARNING: multiple messages have this Message-ID (diff)
From: Andrew Morton <akpm@linux-foundation.org>
To: Minchan Kim <minchan.kim@gmail.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
	Mel Gorman <mel@csn.ul.ie>,
	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: Tue, 1 Mar 2011 14:34:44 -0800	[thread overview]
Message-ID: <20110301143444.2ed102aa.akpm@linux-foundation.org> (raw)
In-Reply-To: <AANLkTimpTyaAU0JzFKp4s14w=ciq152MWSmbgn8xtkOx@mail.gmail.com>

On Wed, 2 Mar 2011 07:22:33 +0900
Minchan Kim <minchan.kim@gmail.com> wrote:

> On Wed, Mar 2, 2011 at 1:19 AM, Andrea Arcangeli <aarcange@redhat.com> wrote:
> > On Wed, Mar 02, 2011 at 12:35:58AM +0900, Minchan Kim wrote:
> >> On Tue, Mar 01, 2011 at 01:49:25PM +0900, KAMEZAWA Hiroyuki wrote:
> >> > On Tue, 1 Mar 2011 13:11:46 +0900
> >> > Minchan Kim <minchan.kim@gmail.com> wrote:
> >> >
>
> ...
>
> > pages freed from irq shouldn't be PageLRU.
> 
> Hmm..
> As looking code, it seems to be no problem and I didn't see the any
> comment about such rule. It should have been written down in
> __page_cache_release.
> Just out of curiosity.
> What kinds of problem happen if we release lru page in irq context?

put_page() from irq context has been permissible for ten years.  I
expect there are a number of sites which do this (via subtle code
paths, often).  It might get messy.

> >
> > deferring freeing to workqueue doesn't look ok. firewall loads runs
> > only from irq and this will cause some more work and a delay in the
> > freeing. I doubt it's worhwhile especially for the lru_lock.
> >
> 
> As you said, if it is for decreasing lock contention in SMP to deliver
> overall better performance, maybe we need to check again how much it
> helps.
> If it doesn't help much, could we remove irq_save/restore of lru_lock?
> Do you know any benchmark to prove it had a benefit at that time or
> any thread discussing about that in lkml?


: commit b10a82b195d63575958872de5721008b0e9bef2d
: Author: akpm <akpm>
: Date:   Thu Aug 15 18:21:05 2002 +0000
: 
:     [PATCH] make pagemap_lru_lock irq-safe
:     
:     It is expensive for a CPU to take an interrupt while holding the page
:     LRU lock, because other CPUs will pile up on the lock while the
:     interrupt runs.
:     
:     Disabling interrupts while holding the lock reduces contention by an
:     additional 30% on 4-way.  This is when the only source of interrupts is
:     disk completion.  The improvement will be higher with more CPUs and it
:     will be higher if there is networking happening.
:     
:     The maximum hold time of this lock is 17 microseconds on 500 MHx PIII,
:     which is well inside the kernel's maximum interrupt latency (which was
:     100 usecs when I last looked, a year ago).
:     
:     This optimisation is not needed on uniprocessor, but the patch disables
:     IRQs while holding pagemap_lru_lock anyway, so it becomes an irq-safe
:     spinlock, and pages can be moved from the LRU in interrupt context.
:     
:     pagemap_lru_lock has been renamed to _pagemap_lru_lock to pick up any
:     missed uses, and to reliably break any out-of-tree patches which may be
:     using the old semantics.
:     
:     BKrev: 3d5bf1110yfdAAur4xqJfiLBDJ2Cqw


Ancient stuff, and not a lot of detail.  But I did measure it.  I
measured everything ;) And, as mentioned, I'd expect that the
contention problems would worsen on higher CPU machines and higher
interrupt frequencies.

I expect we could eliminate the irqsave requirement from
rotate_reclaimable_page() simply by switching to a trylock.  Some pages
will end up at the wrong end of the LRU but the effects may be
negligible.  Or perhaps they may not - disk seeks are costly.

--
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-03-01 22:35 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 15:35 ` Minchan Kim
2011-03-01 16:19 ` Andrea Arcangeli
2011-03-01 16:19   ` Andrea Arcangeli
2011-03-01 22:22   ` Minchan Kim
2011-03-01 22:22     ` Minchan Kim
2011-03-01 22:34     ` Andrew Morton [this message]
2011-03-01 22:34       ` Andrew Morton
2011-03-01 22:57       ` Minchan Kim
2011-03-01 22:57         ` Minchan Kim
  -- strict thread matches above, loose matches on Subject: below --
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 2/2] mm: compaction: Minimise the time IRQs are disabled while isolating pages for migration Mel Gorman
2011-02-25 20:04   ` Mel Gorman
2011-02-25 22:32   ` Johannes Weiner
2011-02-25 22:32     ` Johannes Weiner
2011-02-26  0:16     ` Andrea Arcangeli
2011-02-26  0:16       ` Andrea Arcangeli
2011-02-28  2:17   ` KAMEZAWA Hiroyuki
2011-02-28  2:17     ` KAMEZAWA Hiroyuki
2011-02-28  5:48     ` Andrea Arcangeli
2011-02-28  5:48       ` Andrea Arcangeli
2011-02-28  5:54       ` KAMEZAWA Hiroyuki
2011-02-28  5:54         ` KAMEZAWA Hiroyuki
2011-02-28  9:28         ` Mel Gorman
2011-02-28  9:28           ` Mel Gorman
2011-02-28  9:42           ` KAMEZAWA Hiroyuki
2011-02-28  9:42             ` KAMEZAWA Hiroyuki
2011-02-28 10:18             ` Mel Gorman
2011-02-28 10:18               ` Mel Gorman
2011-02-28 23:42               ` KAMEZAWA Hiroyuki
2011-02-28 23:42                 ` KAMEZAWA Hiroyuki
2011-03-01  4:11                 ` Minchan Kim
2011-03-01  4:11                   ` Minchan Kim
2011-03-01  4:49                   ` KAMEZAWA Hiroyuki
2011-03-01  4:49                     ` KAMEZAWA Hiroyuki
2011-02-28 23:01   ` Minchan Kim
2011-02-28 23:01     ` Minchan Kim
2011-02-28 23:07     ` Andrea Arcangeli
2011-02-28 23:07       ` Andrea Arcangeli
2011-02-28 23:25       ` Minchan Kim
2011-02-28 23:25         ` Minchan Kim
2011-03-01 22:15   ` Andrew Morton
2011-03-01 22:15     ` Andrew Morton
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
2011-02-25 18:00   ` 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=20110301143444.2ed102aa.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=aarcange@redhat.com \
    --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 \
    --cc=mel@csn.ul.ie \
    --cc=minchan.kim@gmail.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.