[PATCH] confdefs: update the CONFIGURE_MEMORY_FOR_POSIX_KEYS for rbtree version.

Gedare Bloom gedare at rtems.org
Tue Mar 5 22:09:09 UTC 2013


On Tue, Mar 5, 2013 at 5:04 PM, Gedare Bloom <gedare at rtems.org> wrote:
> Does this confdefs patch look right? The memory for posix keys is:
> keys * sizeof(POSIX_KEYS_Control) + (keys + pthreads) *
> sizeof(POSIX_Keys_Rbtree_node)
>
On second thought, I think it should be:
keys * sizeof(POSIX_Keys_Control) + keys*pthreads*sizeof(POSIX_Keys_Rbtree_node)

We want the product of keys and pthreads for the setspecific calculation.

> Each pthread is allowed to setspecific on each key, and setspecific
> causes a new rbtree node to be allocated.
>
> Is it more than just pthreads, i.e. can classic threads use the POSIX
> keys mechanism as well? If so the max threads should be used instead
> of max pthreads.
>
> -Gedare
>
> On Tue, Mar 5, 2013 at 5:00 PM, Gedare Bloom <gedare at rtems.org> wrote:
>> ---
>>  cpukit/sapi/include/confdefs.h |    4 +++-
>>  1 files changed, 3 insertions(+), 1 deletions(-)
>>
>> diff --git a/cpukit/sapi/include/confdefs.h b/cpukit/sapi/include/confdefs.h
>> index cc55e92..c8c3564 100644
>> --- a/cpukit/sapi/include/confdefs.h
>> +++ b/cpukit/sapi/include/confdefs.h
>> @@ -1713,7 +1713,9 @@ rtems_fs_init_functions_t    rtems_fs_init_helper =
>>    #else
>>      #define CONFIGURE_MEMORY_FOR_POSIX_KEYS(_keys) \
>>        (_Configure_Object_RAM(_keys, sizeof(POSIX_Keys_Control) ) \
>> -        + (_keys) * 3 * _Configure_From_workspace(sizeof(void *) * 2))
>> +        + (_Configure_Max_Objects(CONFIGURE_MAXIMUM_POSIX_THREADS) \
>> +        + _Configure_Max_Objects(_keys)) \
>> +        * _Configure_From_workspace(sizeof(POSIX_Keys_Rbtree_node)))
>>    #endif
>>
>>    #ifndef CONFIGURE_MAXIMUM_POSIX_TIMERS
>> --
>> 1.7.1
>>



More information about the devel mailing list