lkml.org 
[lkml]   [2003]   [Nov]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    SubjectRe: 2.6.0-test9-mm4
    William Lee Irwin III <wli@holomorphy.com> wrote:
    >>> +#ifdef CONFIG_SMP
    >>> +#define smp_local_irq_save(x) local_irq_save(x)
    >>> +#define smp_local_irq_restore(x) local_irq_restore(x)
    >>> +#define smp_local_irq_disable() local_irq_disable()
    >>> +#define smp_local_irq_enable() local_irq_enable()
    >>> +#else
    [...]

    On Wed, Nov 19, 2003 at 01:19:51AM -0800, Andrew Morton wrote:
    >> Interesting.

    On Wed, Nov 19, 2003 at 01:33:40AM -0800, William Lee Irwin III wrote:
    > This was a micro-optimization for UP; the SMP case needs to protect
    > against reentry via interrupts due to smp_call_function(). UP can
    > just disable preemption. In principle, the two cases could be made
    > uniform at the cost of disabling interrupts unnecessarily on UP.

    The following, incremental atop the first, removes the smp_local_irq_*()
    macros.


    -- wli


    diff -prauN mm4-2.6.0-test9-2/arch/i386/mm/pgtable.c mm4-2.6.0-test9-3/arch/i386/mm/pgtable.c
    --- mm4-2.6.0-test9-2/arch/i386/mm/pgtable.c 2003-11-19 00:22:54.000000000 -0800
    +++ mm4-2.6.0-test9-3/arch/i386/mm/pgtable.c 2003-11-19 02:07:13.000000000 -0800
    @@ -177,7 +177,7 @@ static inline struct page *pte_alloc_rea
    unsigned long flags;
    struct page *page = NULL;

    - smp_local_irq_save(flags);
    + local_irq_save(flags);
    if (tlb->nr_pte_ready) {
    int z;
    for (z = MAX_ZONE_ID - 1; z >= 0; --z) {
    @@ -194,7 +194,7 @@ static inline struct page *pte_alloc_rea
    tlb->ready_count[z]--;
    tlb->nr_pte_ready--;
    }
    - smp_local_irq_restore(flags);
    + local_irq_restore(flags);
    put_cpu();
    return page;
    }
    @@ -381,7 +381,7 @@ static void shrink_cpu_pagetable_cache(v
    high = !!(gfp_mask & __GFP_HIGHMEM);
    cpu = get_cpu();
    tlb = &per_cpu(mmu_gathers, cpu);
    - smp_local_irq_save(flags);
    + local_irq_save(flags);

    if (tlb->nr_pte_active)
    tlb_flush(tlb);
    @@ -417,7 +417,7 @@ static void shrink_cpu_pagetable_cache(v
    tlb->ready_count[zone] = 0;
    }

    - smp_local_irq_restore(flags);
    + local_irq_restore(flags);
    put_cpu();
    }

    diff -prauN mm4-2.6.0-test9-2/include/asm-i386/system.h mm4-2.6.0-test9-3/include/asm-i386/system.h
    --- mm4-2.6.0-test9-2/include/asm-i386/system.h 2003-11-19 00:09:43.000000000 -0800
    +++ mm4-2.6.0-test9-3/include/asm-i386/system.h 2003-11-19 02:06:11.000000000 -0800
    @@ -461,18 +461,6 @@ struct alt_instr {
    /* For spinlocks etc */
    #define local_irq_save(x) __asm__ __volatile__("pushfl ; popl %0 ; cli":"=g" (x): /* no input */ :"memory")

    -#ifdef CONFIG_SMP
    -#define smp_local_irq_save(x) local_irq_save(x)
    -#define smp_local_irq_restore(x) local_irq_restore(x)
    -#define smp_local_irq_disable() local_irq_disable()
    -#define smp_local_irq_enable() local_irq_enable()
    -#else
    -#define smp_local_irq_save(x) do { (void)(x); } while (0)
    -#define smp_local_irq_restore(x) do { (void)(x); } while (0)
    -#define smp_local_irq_disable() do { } while (0)
    -#define smp_local_irq_enable() do { } while (0)
    -#endif /* CONFIG_SMP */
    -
    /*
    * disable hlt during certain critical i/o operations
    */
    diff -prauN mm4-2.6.0-test9-2/include/asm-i386/tlb.h mm4-2.6.0-test9-3/include/asm-i386/tlb.h
    --- mm4-2.6.0-test9-2/include/asm-i386/tlb.h 2003-11-19 00:23:35.000000000 -0800
    +++ mm4-2.6.0-test9-3/include/asm-i386/tlb.h 2003-11-19 02:06:58.000000000 -0800
    @@ -106,7 +106,7 @@ void tlb_flush_mmu(struct mmu_gather *tl
    tlb->need_flush = 0;
    tlb_flush(tlb);

    - smp_local_irq_save(flags);
    + local_irq_save(flags);

    if (tlb->nr_nonpte) {
    free_pages_and_swap_cache(tlb->nonpte, tlb->nr_nonpte);
    @@ -126,7 +126,7 @@ void tlb_flush_mmu(struct mmu_gather *tl
    if (tlb->nr_pte_ready >= NR_PTE)
    tlb_flush_ready(tlb);

    - smp_local_irq_restore(flags);
    + local_irq_restore(flags);
    }

    static inline
    @@ -163,13 +163,13 @@ void tlb_remove_page(struct mmu_gather *
    {
    unsigned long flags;

    - smp_local_irq_save(flags);
    + local_irq_save(flags);
    tlb->need_flush = 1;
    if (PagePTE(page))
    tlb_remove_pte_page(tlb, page);
    else
    tlb_remove_nonpte_page(tlb, page);
    - smp_local_irq_restore(flags);
    + local_irq_restore(flags);
    }

    #endif /* _I386_TLB_H */
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/
    \
     
     \ /
      Last update: 2005-03-22 13:58    [W:0.028 / U:2.280 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site