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

Ashi ashi08104 at gmail.com
Thu Mar 7 02:40:31 UTC 2013


On Wed, Mar 6, 2013 at 11:05 PM, Gedare Bloom <gedare at rtems.org> wrote:

> I see. So your solution is to add another CONFIGURE option that lets a
> user specify the total number of specific keys that might be needed,
> i.e. the number of rbtree nodes that can maximally be allocated. I
> think this is a fine solution. In the worst case it would still be
> threads*keys, but a user can override it. Also, I guess it needs to be
> the total threads and not just the pthreads.
>
Yeah, that's the idea. And the classic API's task is also included by:
(CONFIGURE_MAXIMUM_POSIX_THREADS + CONFIGURE_MAXIMUM_TASKS)

>
> Is it possible for an application developer to know some temporal
> properties about the keys that lets them have key_pairs < keys? For
> example, I might have two keys and one thread, and I could know that
> at any time in my program, the thread only uses one of the keys? In
> that case, the key_pairs can be 1? Or is that too far fetched?
>
it is a good case , the key_pairs can be 1. I just find
pthread_setspecific() can't reassign a key to an new value,
because it need allocate new rb_node before assign a value, I'm not sure is
it a bug or not? The standard seems have no
specification about  this (
http://pubs.opengroup.org/onlinepubs/009604499/functions/pthread_setspecific.html).
If it is not a bug,
I think the two keys and one thread case is a good case that user can have
different key values while keep active key number
small(in this case, active key number is one).

>
> -Gedare
>
> On Wed, Mar 6, 2013 at 9:37 AM, Ashi <ashi08104 at gmail.com> wrote:
> > Gedare, I'm very sorry to find(just now) there is some work hasn't been
> > included in this patch, it is exactly related to confdefs.h,
> > because use thread*keys to caculate memory is not very accurate, I
> introduce
> > a key_pair
> > variable(
> http://www.rtems.org/wiki/index.php/Use_Hash_or_Map_in_POSIX_Key),
> > there are several commits on my
> > github(https://github.com/ashi08104/rtems/commits/one_rbtree, commits
> after
> > Aug 28,2012 are related). I'll update the patch as soon as possible.
> >
> >
> > On Wed, Mar 6, 2013 at 6:12 AM, Gedare Bloom <gedare at rtems.org> wrote:
> >>
> >> ---
> >>  cpukit/sapi/include/confdefs.h |    7 ++++++-
> >>  1 files changed, 6 insertions(+), 1 deletions(-)
> >>
> >> diff --git a/cpukit/sapi/include/confdefs.h
> >> b/cpukit/sapi/include/confdefs.h
> >> index cc55e92..fcfdb44 100644
> >> --- a/cpukit/sapi/include/confdefs.h
> >> +++ b/cpukit/sapi/include/confdefs.h
> >> @@ -1713,7 +1713,12 @@ 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_From_workspace( \
> >> +          _Configure_Max_Objects(CONFIGURE_MAXIMUM_POSIX_THREADS) \
> >> +          * _Configure_Max_Objects(_keys) \
> >> +          * sizeof(POSIX_Keys_Rbtree_node) \
> >> +        ) \
> >> +      )
> >>    #endif
> >>
> >>    #ifndef CONFIGURE_MAXIMUM_POSIX_TIMERS
> >> --
> >> 1.7.1
> >>
> >> _______________________________________________
> >> rtems-devel mailing list
> >> rtems-devel at rtems.org
> >> http://www.rtems.org/mailman/listinfo/rtems-devel
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20130307/a75e86e6/attachment.html>


More information about the devel mailing list