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

Changeset 103de761 in mainline


Ignore:
Timestamp:
2009-11-28T11:03:58Z (12 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master
Children:
e701eb1
Parents:
fb7c52f
Message:

Introduce a slab cache for task_t and allocate/free tasks from/to it.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/proc/task.c

    rfb7c52f r103de761  
    7575static task_id_t task_counter = 0;
    7676
     77static slab_cache_t *task_slab;
     78
    7779/* Forward declarations. */
    7880static void task_kill_internal(task_t *);
     
    8385        TASK = NULL;
    8486        avltree_create(&tasks_tree);
     87        task_slab = slab_cache_create("task_slab", sizeof(task_t), 0, NULL,
     88            NULL, 0);
    8589}
    8690
     
    142146        int i;
    143147       
    144         ta = (task_t *) malloc(sizeof(task_t), 0);
     148        ta = (task_t *) slab_alloc(task_slab, 0);
    145149
    146150        task_create_arch(ta);
     
    230234                as_destroy(t->as);
    231235       
    232         free(t);
     236        slab_free(task_slab, t);
    233237        TASK = NULL;
    234238}
Note: See TracChangeset for help on using the changeset viewer.