linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* The last slab destructor .....
@ 2007-05-08 21:04 Christoph Lameter
  0 siblings, 0 replies; only message in thread
From: Christoph Lameter @ 2007-05-08 21:04 UTC (permalink / raw)
  To: Paul Mundt; +Cc: linux-mm, akpm

As far as I can tell: We will soon have only a single slab destructor 
still in use in the kernel (after the quicklist migrations have finished 
upstream). I wonder how difficult it would be to remove it? If we have no 
destructors anymore then maybe we could remove destructor support from the 
slab allocators? Or are there valid reason to keep them around? It seems 
they were mainly used for list management which required them to take a 
spinlock. Taking a spinlock in a destructor is a bit risky since the slab 
allocators may run the destructors anytime they decide a slab is no longer 
needed.

The last one is in

arch/mm/pmb.c:

static void pmb_cache_ctor(void *pmb, struct kmem_cache *cachep, unsigned 
long flags)
{
        struct pmb_entry *pmbe = pmb;

        memset(pmb, 0, sizeof(struct pmb_entry));

        spin_lock_irq(&pmb_list_lock);

        pmbe->entry = PMB_NO_ENTRY;
        pmb_list_add(pmbe);

        spin_unlock_irq(&pmb_list_lock);
}

static void pmb_cache_dtor(void *pmb, struct kmem_cache *cachep, unsigned 
long flags)
{
        spin_lock_irq(&pmb_list_lock);
        pmb_list_del(pmb);
        spin_unlock_irq(&pmb_list_lock);
}

static int __init pmb_init(void)
{
        unsigned int nr_entries = ARRAY_SIZE(pmb_init_map);
        unsigned int entry;

        BUG_ON(unlikely(nr_entries >= NR_PMB_ENTRIES));

        pmb_cache = kmem_cache_create("pmb", sizeof(struct pmb_entry), 0,
                                      SLAB_PANIC, pmb_cache_ctor,
                                      pmb_cache_dtor);

        jump_to_P2();

        /*
         * Ordering is important, P2 must be mapped in the PMB before we
         * can set PMB.SE, and P1 must be mapped before we jump back to
         * P1 space.
         */
        for (entry = 0; entry < nr_entries; entry++) {
                struct pmb_entry *pmbe = pmb_init_map + entry;

                __set_pmb_entry(pmbe->vpn, pmbe->ppn, pmbe->flags, 
&entry);
        }

        ctrl_outl(0, PMB_IRMCR);

        /* PMB.SE and UB[7] */
        ctrl_outl((1 << 31) | (1 << 7), PMB_PASCR);

        back_to_P1();

        return 0;
}
arch_initcall(pmb_init);

--
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/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-05-08 21:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-05-08 21:04 The last slab destructor Christoph Lameter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox