[PATCH 01/10] score: Add get/set affinity to Scheduler Framework.

Sebastian Huber sebastian.huber at embedded-brains.de
Tue Apr 1 08:02:08 UTC 2014


On 2014-04-01 15:50, Jennifer Averett wrote:
>>>> > >>+  /**
>>>> > >>+   * @brief Get affinity for the default scheduler.
>>>> > >>+   *
>>>> > >>+   * @param[in] thread The associated thread.
>>>> > >>+   * @param[in] cpusetsize The size of the cpuset.
>>>> > >>+   * @param[out] cpuset Affinity set containing all CPUs.
>>>> > >>+   *
>>>> > >>+   * @retval 0 Successfully got cpuset
>>>> > >>+   * @retval -1 The cpusetsize is invalid for the system
>>>> > >>+   */
>>>> > >>+  int _Scheduler_default_Get_affinity(
>>>> > >>+    Thread_Control *thread,
>>>> > >>+    size_t          cpusetsize,
>>>> > >>+    cpu_set_t      *cpuset
>>>> > >>+  );
>>>> > >>+
>>>> > >>+  /**
>>>> > >>+   * @brief Set affinity for the default scheduler.
>>>> > >>+   *
>>>> > >>+   * @param[in] thread The associated thread.
>>>> > >>+   * @param[in] cpusetsize The size of the cpuset.
>>>> > >>+   * @param[in] cpuset Affinity new affinity set.
>>>> > >>+   *
>>>> > >>+   * @retval 0 Successful
>>>> > >>+   *
>>>> > >>+   *  This method always returns successful and does not save
>>>> > >>+   *  the cpuset.
>>>> > >>+   */
>>>> > >>+  int _Scheduler_default_Set_affinity(
>>>> > >>+    Thread_Control *thread,
>>>> > >>+    size_t          cpusetsize,
>>>> > >>+    cpu_set_t      *cpuset
>>>> > >>+  );
>>>> > >>+#endif
>>> > >
>>> > >
>>> > >I would rather use bool or an enum for the return status instead of
>>> > >this int.
>>> > >
>>> > >The default set affinity operation should accept only CPU sets that
>>> > >specify the complete set of available processors, e.g. for a three
>>> > >processor system it should be bits 0, 1, and 2 set, all other bits
>>> > >cleared (e.g. (1 << CPU
>>> > >count) - 1).
>>> > >
>>> > >The default get affinity operation should return the CPU sets
>>> > >reflecting all available processors.
>>> > >
>> >I agree with the logic for the defaults Sebastian suggests.
> Actually no scheduler should be allowed to set the affinity to
> A cpu that the system doesn't support.  Currently those checks
> are called from the API methods.
>

I thought this is check in the high level code is only a temporary solution? 
The responsibility for thread processor affinity management should move 
entirely to the scheduler.

-- 
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber at embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.



More information about the devel mailing list