This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Patch - Add pthread affinity for RTEMS


On 11/25/2013 1:44 AM, Sebastian Huber wrote:
> On 2013-11-22 20:20, Joel Sherrill wrote:
>>
>>>>>> +#if defined(__rtems__)
>>>>>> +  size_t guardsize;
>>>>>> +  cpu_set_t affinity;
>>>>
>>>> In the pthread_attr_setaffinity_np() function we allow arbitrary sized CPU
>>>> sets.  What happens if sizeof(cpu_set_t) < __cpusetsize?
>> We do not have the CPUSET APIs for variable sized cpu_set_t.
>> For now, if sizeof(cpu_set_t) != __cpusetsize, then it is an
>> error.
>>
>> This is an implementation detail until we decide to add the
>> variable size cpu_set_t APIs to cpuset.h and follow up in
>> the implementation of affinity routines in RTEMS.
>>
>> Cynically, we have a lot of work to do before we have to
>> worry about more than 32 cores. We can fix this along the
>> way if it is a problem.:)
> 
> We should prevent future incompatibilities.
> 
> I would use this:
> 
> diff --git a/newlib/libc/include/sys/types.h b/newlib/libc/include/sys/types.h
> index 0627ca9..58b1520 100644
> --- a/newlib/libc/include/sys/types.h
> +++ b/newlib/libc/include/sys/types.h
> @@ -352,6 +352,11 @@ typedef struct {
>   #endif
>     int  detachstate;
> 
> +#if defined(__rtems__)
> +  size_t affinitysetsize;
> +  cpu_set_t *affinityset;
> +  cpu_set_t affinitysetdefault;
> +#endif
>   } pthread_attr_t;
> 
>   #endif /* !defined(__XMK__) */
> 
> In case the normal cpu_set_t is sufficient, then 
> pthread_attr_setaffinity_np(attr, cpusetsize, cpuset) can use
> 
> attr->affinityset = &attr->affinitysetdefault;
> 
> to avoid dynamic memory.
> 

We can do that but it is pointless. We don't have the CPUSET XXX_S
methods for ways to create and manipulate them.

Frankly Sebastian, I just don't see the point right now.


-- 
Joel Sherrill, Ph.D.             Director of Research & Development
joel.sherrill@OARcorp.com        On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
Support Available                (256) 722-9985


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]