[PATCH] ZVC: Overstep counters
Increments and decrements are usually grouped rather than mixed. We can optimize the inc and dec functions for that case. Increment and decrement the counters by 50% more than the threshold in those cases and set the differential accordingly. This decreases the need to update the atomic counters. The idea came originally from Andrew Morton. The overstepping alone was sufficient to address the contention issue found when updating the global and the per zone counters from 160 processors. Also remove some code in dec_zone_page_state. Signed-off-by: Christoph Lameter <clameter@sgi.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
Родитель
b63fe1ba44
Коммит
a302eb4e46
20
mm/vmstat.c
20
mm/vmstat.c
|
@ -190,8 +190,8 @@ static void __inc_zone_state(struct zone *zone, enum zone_stat_item item)
|
||||||
(*p)++;
|
(*p)++;
|
||||||
|
|
||||||
if (unlikely(*p > STAT_THRESHOLD)) {
|
if (unlikely(*p > STAT_THRESHOLD)) {
|
||||||
zone_page_state_add(*p, zone, item);
|
zone_page_state_add(*p + STAT_THRESHOLD / 2, zone, item);
|
||||||
*p = 0;
|
*p = -STAT_THRESHOLD / 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -209,8 +209,8 @@ void __dec_zone_page_state(struct page *page, enum zone_stat_item item)
|
||||||
(*p)--;
|
(*p)--;
|
||||||
|
|
||||||
if (unlikely(*p < -STAT_THRESHOLD)) {
|
if (unlikely(*p < -STAT_THRESHOLD)) {
|
||||||
zone_page_state_add(*p, zone, item);
|
zone_page_state_add(*p - STAT_THRESHOLD / 2, zone, item);
|
||||||
*p = 0;
|
*p = STAT_THRESHOLD /2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(__dec_zone_page_state);
|
EXPORT_SYMBOL(__dec_zone_page_state);
|
||||||
|
@ -239,19 +239,9 @@ EXPORT_SYMBOL(inc_zone_page_state);
|
||||||
void dec_zone_page_state(struct page *page, enum zone_stat_item item)
|
void dec_zone_page_state(struct page *page, enum zone_stat_item item)
|
||||||
{
|
{
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
struct zone *zone;
|
|
||||||
s8 *p;
|
|
||||||
|
|
||||||
zone = page_zone(page);
|
|
||||||
local_irq_save(flags);
|
local_irq_save(flags);
|
||||||
p = diff_pointer(zone, item);
|
__dec_zone_page_state(page, item);
|
||||||
|
|
||||||
(*p)--;
|
|
||||||
|
|
||||||
if (unlikely(*p < -STAT_THRESHOLD)) {
|
|
||||||
zone_page_state_add(*p, zone, item);
|
|
||||||
*p = 0;
|
|
||||||
}
|
|
||||||
local_irq_restore(flags);
|
local_irq_restore(flags);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(dec_zone_page_state);
|
EXPORT_SYMBOL(dec_zone_page_state);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче