Changeset 0aae87a6 in mainline


Ignore:
Timestamp:
2012-11-09T19:33:11Z (12 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
67b152e
Parents:
3b8a990
Message:

Unify the default stack size used by userspace threads and fibrils.

  • The size is stored by the kernel into sysinfo.
  • stack_size_get() reads this value from sysinfo and caches it locally.
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/main/kinit.c

    r3b8a990 r0aae87a6  
    172172#endif /* CONFIG_KCONSOLE */
    173173       
     174        /*
     175         * Store the default stack size in sysinfo so that uspace can create
     176         * stack with this default size.
     177         */
     178        sysinfo_set_item_val("default.stack_size", NULL, STACK_SIZE);
     179       
    174180        interrupts_enable();
    175181       
  • uspace/lib/c/Makefile

    r3b8a990 r0aae87a6  
    140140        generic/net/socket_client.c \
    141141        generic/net/socket_parse.c \
     142        generic/stack.c \
    142143        generic/stacktrace.c \
    143144        generic/arg_parse.c \
  • uspace/lib/c/generic/fibril.c

    r3b8a990 r0aae87a6  
    3737#include <fibril.h>
    3838#include <thread.h>
     39#include <stack.h>
    3940#include <tls.h>
    4041#include <malloc.h>
     
    271272                return 0;
    272273       
    273         fibril->stack = as_area_create((void *) -1,
    274             FIBRIL_INITIAL_STACK_PAGES_NO * getpagesize(),
     274        size_t stack_size = stack_size_get();
     275        fibril->stack = as_area_create((void *) -1, stack_size,
    275276            AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE | AS_AREA_GUARD |
    276277            AS_AREA_LATE_RESERVE);
     
    285286        context_save(&fibril->ctx);
    286287        context_set(&fibril->ctx, FADDR(fibril_main), fibril->stack,
    287             FIBRIL_INITIAL_STACK_PAGES_NO * getpagesize(), fibril->tcb);
     288            stack_size, fibril->tcb);
    288289
    289290        return (fid_t) fibril;
  • uspace/lib/c/generic/thread.c

    r3b8a990 r0aae87a6  
    3939#include <abi/proc/uarg.h>
    4040#include <fibril.h>
     41#include <stack.h>
    4142#include <str.h>
    4243#include <async.h>
     
    101102                return ENOMEM;
    102103       
    103         size_t stack_size = getpagesize() * THREAD_INITIAL_STACK_PAGES;
     104        size_t stack_size = stack_size_get();
    104105        void *stack = as_area_create(AS_AREA_ANY, stack_size,
    105106            AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE | AS_AREA_GUARD |
Note: See TracChangeset for help on using the changeset viewer.