mm: compaction: Minimise the time IRQs are disabled while isolating pages for migration
Subsystems (2)
Quoted 18 lines · KAMEZAWA Hiroyuki
Quoted 15 lines · On Tue, 1 Mar 2011 13:11:46 +0900 Minchan Kim <[email protected]> wrote:
Quoted 13 lines · KAMEZAWA Hiroyuki
Quoted 7 lines · On Mon, 28 Feb 2011 10:18:27 +0000 Mel Gorman <[email protected]> wrote:
Quoted 2 lines
BTW, can't we drop
disable_irq()from alllru_lockrelated 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_irqis necessary.pagevec draining is done by workqueue(schedule_on_each_cpu()). I think only racy case is just lru rotation after writeback.
Quoted 6 lines
Quoted 2 lines
put_pagestill need irq disable.Aha..ok.
put_page()removes a page from LRU via__page_cache_release(). Then, we may need to remove a page from LRU under irq context. Hmm...
But as __page_cache_release's comment said, normally vm doesn't release page in irq context. so it would be rare.
If we can remove it, could we change all of spin_lock_irqsave with spin_lock? If it is right, I think it's very desirable to reduce irq latency.
How about this? It's totally a quick implementation and untested. I just want to hear opinions of you guys if the work is valuable or not before going ahead.
== CUT_HERE ==
include/linux/mm.h +1 -1
@@ -1353,7 +1353,7 @@ extern void si_meminfo_node(struct sysinfo *val, int nid);extern int after_bootmem;extern void setup_per_cpu_pageset (void ); - +extern void setup_per_cpu_defer_free_pages (void );extern void zone_pcp_update (struct zone *zone);/* nommu.c */
init/main.c +1 -0
@@ -583,6 +583,7 @@ asmlinkage void __init start_kernel(void)kmemleak_init ();debug_objects_mem_init ();setup_per_cpu_pageset (); +setup_per_cpu_defer_free_pages ();numa_policy_init ();if (late_time_init)late_time_init ();
mm/swap.c +79 -2
99 lines not on this page · raw message
Quoted 4 lines
Thanks,
-Kame
Signature · 9 lines
Kind regards, Minchan Kim -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. 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:"[email protected]"> [email protected] </a>
Quoted 26 lines · Minchan Kim
Quoted 18 lines · KAMEZAWA Hiroyuki
Quoted 15 lines · On Tue, 1 Mar 2011 13:11:46 +0900 Minchan Kim <[email protected]> wrote:
Quoted 13 lines · KAMEZAWA Hiroyuki
Quoted 7 lines · On Mon, 28 Feb 2011 10:18:27 +0000 Mel Gorman <[email protected]> wrote:
Quoted 2 lines
BTW, can't we drop
disable_irq()from alllru_lockrelated 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_irqis necessary.pagevec draining is done by workqueue(schedule_on_each_cpu()). I think only racy case is just lru rotation after writeback.
Quoted 6 lines
Quoted 2 lines
put_pagestill need irq disable.Aha..ok.
put_page()removes a page from LRU via__page_cache_release(). Then, we may need to remove a page from LRU under irq context. Hmm...
Quoted 8 lines
But as __page_cache_release's comment said, normally vm doesn't release page in irq context. so it would be rare.
If we can remove it, could we change all ofspin_lock_irqsavewithspin_lock? If it is right, I think it's very desirable to reduce irq latency.How about this? It's totally a quick implementation and untested. I just want to hear opinions of you guys if the work is valuable or not before going ahead.
pages freed from irq shouldn't be PageLRU.
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.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. 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:"[email protected]"> [email protected] </a>
Quoted 32 lines · Andrea Arcangeli
Quoted 31 lines · Minchan Kim
Quoted 18 lines · KAMEZAWA Hiroyuki
Quoted 15 lines · On Tue, 1 Mar 2011 13:11:46 +0900 Minchan Kim <[email protected]> wrote:
Quoted 13 lines · KAMEZAWA Hiroyuki
Quoted 7 lines · On Mon, 28 Feb 2011 10:18:27 +0000 Mel Gorman <[email protected]> wrote:
Quoted 2 lines
BTW, can't we drop
disable_irq()from alllru_lockrelated 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_irqis necessary.pagevec draining is done by workqueue(schedule_on_each_cpu()). I think only racy case is just lru rotation after writeback.
Quoted 6 lines
Quoted 2 lines
put_pagestill need irq disable.Aha..ok.
put_page()removes a page from LRU via__page_cache_release(). Then, we may need to remove a page from LRU under irq context. Hmm...But as __page_cache_release's comment said, normally vm doesn't release page in irq context. so it would be rare.
If we can remove it, could we change all ofspin_lock_irqsavewithspin_lock? If it is right, I think it's very desirable to reduce irq latency.
Quoted 5 lines
Quoted 3 lines
How about this? It's totally a quick implementation and untested. I just want to hear opinions of you guys if the work is valuable or not before going ahead.
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?
Quoted 5 lines
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?
Thanks, Andrea.
Signature · 9 lines
Kind regards, Minchan Kim -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. 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:"[email protected]"> [email protected] </a>
Andrew Morton
maintainerQuoted 9 lines · On Wed, 2 Mar 2011 07:22:33 +0900 Minchan Kim <[email protected]> wrote:
Quoted 5 lines · Andrea Arcangeli
Quoted 4 lines · Minchan Kim
Quoted 3 lines · KAMEZAWA Hiroyuki
On Tue, 1 Mar 2011 13:11:46 +0900
Minchan Kim <[email protected]> wrote:...
Quoted 8 lines
Quoted 1 line
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.
Quoted 6 lines
Quoted 5 lines
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.
Quoted 6 lines
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 oflru_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 [email protected]. 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:"[email protected]"> [email protected] </a>
Quoted 69 lines · Andrew Morton
Quoted 9 lines · On Wed, 2 Mar 2011 07:22:33 +0900 Minchan Kim <[email protected]> wrote:
Quoted 5 lines · Andrea Arcangeli
Quoted 4 lines · Minchan Kim
Quoted 3 lines · KAMEZAWA Hiroyuki
On Tue, 1 Mar 2011 13:11:46 +0900
Minchan Kim <[email protected]> wrote:...
Quoted 8 lines
Quoted 1 line
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.Quoted 6 lines
Quoted 5 lines
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.Quoted 6 lines
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 oflru_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] makepagemap_lru_lockirq-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 holdingpagemap_lru_lockanyway, so it becomes an irq-safe : spinlock, and pages can be moved from the LRU in interrupt context. :
:pagemap_lru_lockhas been renamed to_pagemap_lru_lockto pick up any : missed uses, and to reliably break any out-of-tree patches which may be : using the old semantics.
:
: BKrev: 3d5bf1110yfdAAur4xqJfiLBDJ2Cqw
Quoted 4 lines
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.
Thanks for giving the important information.
Quoted 7 lines
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.
Releasing 14 pages should not have much cost about interrupt latency and It's a general concept we have been used. If it really has a problem, I think it would be better to reduce PAGEVEC_SIZE rather than fixing the rotate_reclaimable_page.
Signature · 9 lines
Kind regards, Minchan Kim -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. 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:"[email protected]"> [email protected] </a>