Re: 2.6.0-test11-wli-2

From: William Lee Irwin III
Date: Fri Dec 12 2003 - 20:29:07 EST


On Wed, Dec 10, 2003 at 09:29:29PM -0800, William Lee Irwin III wrote:
> Successfully tested on a Thinkpad T21 and 32GB NUMA-Q. Any feedback
> regarding performance would be very helpful. Desktop users should
> notice top(1) is faster, kernel hackers that kernel compiles are faster,
> and highmem users should see much less per-process lowmem overhead

shrink_pagetable_cache() can't really do a TLB shootdown like it would
want to (at least not in the IPI handler!), and there isn't really a
good way to sync them all so they've flushed their TLB's before any of
them proceeds. So trim only the ready list. Also clean up some excess
whitespace and a bad gfp_mask initializer in shrink_cpu_pagetable_cache().
Maybe gcc should add a _useful_ warning for once and complain about
recursive initialization without any indirection. There's also no
reason to wait for the things to finish; we don't return a meaningful
status as it stands, though at some point it may be worthwhile to
change that if it matters how much we freed.


-- wli


diff -prauN wli-2.6.0-test11-33-A/arch/i386/mm/pgtable.c wli-2.6.0-test11-numaq-33-A/arch/i386/mm/pgtable.c
--- wli-2.6.0-test11-33-A/arch/i386/mm/pgtable.c 2003-12-04 07:36:00.000000000 -0800
+++ wli-2.6.0-test11-numaq-33-A/arch/i386/mm/pgtable.c 2003-12-12 16:33:34.000000000 -0800
@@ -298,32 +298,18 @@ void pgd_free(pgd_t *pgd)

static void shrink_cpu_pagetable_cache(void *__gfp_mask)
{
- int cpu, zone, high, gfp_mask = (int)gfp_mask;
+ int cpu, zone, high, gfp_mask = (int)__gfp_mask;
unsigned long flags;
struct mmu_gather *tlb;

high = !!(gfp_mask & __GFP_HIGHMEM);
cpu = get_cpu();
tlb = &per_cpu(mmu_gathers, cpu);
- smp_local_irq_save(flags);

- if (tlb->nr_pte_active || tlb->nr_nonpte)
- tlb_flush(tlb);
+ smp_local_irq_save(flags);

- if (tlb->nr_pte_active) {
- for (zone = 0; zone < MAX_ZONE_ID; ++zone) {
- if (!high && zone_high(zone_table[zone]))
- continue;
- if (!tlb->active_count[zone])
- continue;
-
- list_splice_init(&tlb->active_list[zone], &tlb->ready_list[zone]);
- tlb->ready_count[zone] += tlb->active_count[zone];
- tlb->active_count[zone] = 0;
- }
- tlb->nr_pte_ready += tlb->nr_pte_active;
- tlb->nr_pte_active = 0;
- }
+ if (!tlb->nr_pte_ready)
+ goto out;

for (zone = 0; zone < MAX_ZONE_ID; ++zone) {
struct page *head;
@@ -341,7 +327,7 @@ static void shrink_cpu_pagetable_cache(v
tlb->ready_count[zone] = 0;
free_pages_bulk(zone_table[zone], head, 0);
}
-
+out:
smp_local_irq_restore(flags);
put_cpu();
}
@@ -349,13 +335,9 @@ static void shrink_cpu_pagetable_cache(v
void shrink_pagetable_cache(int gfp_mask)
{
BUG_ON(irqs_disabled());
-
preempt_disable();
-
- /* disables interrupts appropriately internally */
+ smp_call_function(shrink_cpu_pagetable_cache, (void *)gfp_mask, 0, 0);
shrink_cpu_pagetable_cache((void *)gfp_mask);
-
- smp_call_function(shrink_cpu_pagetable_cache, (void *)gfp_mask, 1, 1);
preempt_enable();
}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/