Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 431c402 in mainline


Ignore:
Timestamp:
2017-09-04T20:08:28Z (4 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master
Children:
e5f5ce0
Parents:
fa32c9f
Message:

Create a slab cache for allocating irq_t structures

Location:
kernel/generic
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/include/ddi/irq.h

    rfa32c9f r431c402  
    4343#include <proc/task.h>
    4444#include <ipc/ipc.h>
     45#include <mm/slab.h>
    4546
    4647typedef enum {
     
    139140extern hash_table_t irq_uspace_hash_table;
    140141
     142extern slab_cache_t *irq_slab;
     143
    141144extern inr_t last_inr;
    142145
  • kernel/generic/src/ddi/irq.c

    rfa32c9f r431c402  
    4949#include <arch.h>
    5050
     51slab_cache_t *irq_slab = NULL;
     52
    5153/** Spinlock protecting the kernel IRQ hash table
    5254 *
     
    9597        buckets = chains;
    9698        last_inr = inrs - 1;
     99
     100        irq_slab = slab_cache_create("irq_t", sizeof(irq_t), 0, NULL, NULL,
     101            FRAME_ATOMIC);
     102        assert(irq_slab);
    97103
    98104        hash_table_create(&irq_uspace_hash_table, chains, 2, &irq_ht_ops);
  • kernel/generic/src/ipc/irq.c

    rfa32c9f r431c402  
    308308                return handle;
    309309       
    310         irq_t *irq = (irq_t *) malloc(sizeof(irq_t), FRAME_ATOMIC);
     310        irq_t *irq = (irq_t *) slab_alloc(irq_slab, FRAME_ATOMIC);
    311311        if (!irq) {
    312312                cap_free(TASK, handle);
     
    384384       
    385385        /* Free up the IRQ capability and the underlying kernel object. */
    386         free(cap->kobject);
     386        slab_free(irq_slab, cap->kobject);
    387387        cap_free(TASK, handle);
    388388       
Note: See TracChangeset for help on using the changeset viewer.