Changeset f76fed4 in mainline for generic/src/proc/thread.c


Ignore:
Timestamp:
2006-03-03T00:20:31Z (19 years ago)
Author:
Ondrej Palkovsky <ondrap@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
09c18f7
Parents:
ddcf365
Message:

Added lazy fpu context allocation.

  • threads that don't use fpu, don't get allocated fpu context
  • fpu context alignment on AMD64 nicely disappeared
File:
1 edited

Legend:

Unmodified
Added
Removed
  • generic/src/proc/thread.c

    rddcf365 rf76fed4  
    6464
    6565static slab_cache_t *thread_slab;
     66#ifdef ARCH_HAS_FPU
     67slab_cache_t *fpu_context_slab;
     68#endif
    6669
    6770
     
    104107        link_initialize(&t->threads_link);
    105108       
     109#ifdef ARCH_HAS_FPU
     110#  ifdef CONFIG_FPU_LAZY
     111        t->saved_fpu_context = NULL;
     112#  else
     113        t->saved_fpu_context = slab_alloc(fpu_context_slab,kmflags);
     114        if (!t->saved_fpu_context)
     115                return -1;
     116#  endif
     117#endif 
     118
    106119        pfn = frame_alloc_rc(ONE_FRAME, FRAME_KA | kmflags,&status);
    107         if (status)
     120        if (status) {
     121#ifdef ARCH_HAS_FPU
     122                if (t->saved_fpu_context)
     123                        slab_free(fpu_context_slab,t->saved_fpu_context);
     124#endif
    108125                return -1;
     126        }
    109127        t->kstack = (__u8 *)PA2KA(PFN2ADDR(pfn));
    110128
     
    118136
    119137        frame_free(ADDR2PFN(KA2PA(t->kstack)));
     138#ifdef ARCH_HAS_FPU
     139        if (t->saved_fpu_context)
     140                slab_free(fpu_context_slab,t->saved_fpu_context);
     141#endif
    120142        return 1; /* One page freed */
    121143}
     
    133155                                        sizeof(thread_t),0,
    134156                                        thr_constructor, thr_destructor, 0);
     157#ifdef ARCH_HAS_FPU
     158        fpu_context_slab = slab_cache_create("fpu_slab",
     159                                             sizeof(fpu_context_t),
     160                                             FPU_CONTEXT_ALIGN,
     161                                             NULL, NULL, 0);
     162#endif
    135163}
    136164
Note: See TracChangeset for help on using the changeset viewer.