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

Sebastian Huber sebastian.huber at embedded-brains.de
Tue Mar 25 07:20:56 UTC 2014


On 2014-03-24 19:39, Jennifer wrote:
> @@ -184,6 +205,43 @@ void _Scheduler_default_Start_idle(
>     Per_CPU_Control *processor
>   );
>
> +#if defined(__RTEMS_HAVE_SYS_CPUSET_H__) && defined(RTEMS_SMP)
> +
> +  /**
> +   * @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.

-- 
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