Changeset 436a0a5 in mainline for kernel/generic/src/ipc/ipc.c


Ignore:
Timestamp:
2018-11-09T22:04:01Z (6 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
95d45482
Parents:
88e43bc (diff), abf6c01 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

(merge) Reduce the number of blocking allocations in the kernel

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/ipc/ipc.c

    r88e43bc r436a0a5  
    108108 * TASK->answerbox.
    109109 *
    110  * @param flags Parameters for slab_alloc (e.g FRAME_ATOMIC).
    111  *
    112  * @return If flags permit it, return NULL, or initialized kernel
    113  *         call structure with one reference.
    114  *
    115  */
    116 call_t *ipc_call_alloc(unsigned int flags)
    117 {
    118         call_t *call = slab_alloc(call_cache, flags);
     110 * @return Initialized kernel call structure with one reference, or NULL.
     111 *
     112 */
     113call_t *ipc_call_alloc(void)
     114{
     115        // TODO: Allocate call and kobject in single allocation
     116
     117        call_t *call = slab_alloc(call_cache, FRAME_ATOMIC);
    119118        if (!call)
    120119                return NULL;
    121120
    122         kobject_t *kobj;
    123         if (flags & FRAME_ATOMIC)
    124                 kobj = (kobject_t *) malloc(sizeof(kobject_t));
    125         else
    126                 kobj = (kobject_t *) nfmalloc(sizeof(kobject_t));
    127 
     121        kobject_t *kobj = (kobject_t *) malloc(sizeof(kobject_t));
    128122        if (!kobj) {
    129123                slab_free(call_cache, call);
     
    219213errno_t ipc_call_sync(phone_t *phone, call_t *request)
    220214{
    221         answerbox_t *mybox = slab_alloc(answerbox_cache, 0);
     215        answerbox_t *mybox = slab_alloc(answerbox_cache, FRAME_ATOMIC);
     216        if (!mybox)
     217                return ENOMEM;
     218
    222219        ipc_answerbox_init(mybox, TASK);
    223220
     
    483480                kobject_put(phone->kobject);
    484481
    485                 call_t *call = ipc_call_alloc(0);
     482                call_t *call = phone->hangup_call;
     483                phone->hangup_call = NULL;
     484                assert(call);
     485
    486486                IPC_SET_IMETHOD(call->data, IPC_M_PHONE_HUNGUP);
    487487                call->request_method = IPC_M_PHONE_HUNGUP;
     
    685685                         * to exist as soon as we release it.
    686686                         */
    687                         call_t *call = ipc_call_alloc(0);
     687                        call_t *call = phone->hangup_call;
     688                        phone->hangup_call = NULL;
     689                        assert(call);
     690
    688691                        IPC_SET_IMETHOD(call->data, IPC_M_PHONE_HUNGUP);
    689692                        call->request_method = IPC_M_PHONE_HUNGUP;
Note: See TracChangeset for help on using the changeset viewer.