mali_kbase_js_policy_cfs.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*
  2. *
  3. * (C) COPYRIGHT 2011-2015 ARM Limited. All rights reserved.
  4. *
  5. * This program is free software and is provided to you under the terms of the
  6. * GNU General Public License version 2 as published by the Free Software
  7. * Foundation, and any use by you of this program is subject to the terms
  8. * of such GNU licence.
  9. *
  10. * A copy of the licence is included with the program, and can also be obtained
  11. * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  12. * Boston, MA 02110-1301, USA.
  13. *
  14. */
  15. /*
  16. * Completely Fair Job Scheduler Policy structure definitions
  17. */
  18. #ifndef _KBASE_JS_POLICY_CFS_H_
  19. #define _KBASE_JS_POLICY_CFS_H_
  20. #define KBASEP_JS_RUNTIME_EMPTY ((u64)-1)
  21. /**
  22. * struct kbasep_js_policy_cfs - Data for the CFS policy
  23. * @head_runtime_us: Number of microseconds the least-run context has been
  24. * running for. The kbasep_js_device_data.queue_mutex must
  25. * be held whilst updating this.
  26. * Reads are possible without this mutex, but an older value
  27. * might be read if no memory barries are issued beforehand.
  28. * @least_runtime_us: Number of microseconds the least-run context in the
  29. * context queue has been running for.
  30. * -1 if context queue is empty.
  31. * @rt_least_runtime_us: Number of microseconds the least-run context in the
  32. * realtime (priority) context queue has been running for.
  33. * -1 if realtime context queue is empty
  34. */
  35. struct kbasep_js_policy_cfs {
  36. u64 head_runtime_us;
  37. atomic64_t least_runtime_us;
  38. atomic64_t rt_least_runtime_us;
  39. };
  40. /**
  41. * struct kbasep_js_policy_cfs_ctx - a single linked list of all contexts
  42. * @runtime_us: microseconds this context has been running for
  43. * @process_rt_policy: set if calling process policy scheme is a realtime
  44. * scheduler and will use the priority queue. Non-mutable
  45. * after ctx init
  46. * @process_priority: calling process NICE priority, in the range -20..19
  47. *
  48. * &kbasep_js_device_data.runpool_irq.lock must be held when updating
  49. * @runtime_us. Initializing will occur on context init and context enqueue
  50. * (which can only occur in one thread at a time), but multi-thread access only
  51. * occurs while the context is in the runpool.
  52. *
  53. * Reads are possible without the spinlock, but an older value might be read if
  54. * no memory barries are issued beforehand.
  55. */
  56. struct kbasep_js_policy_cfs_ctx {
  57. u64 runtime_us;
  58. bool process_rt_policy;
  59. int process_priority;
  60. };
  61. /**
  62. * struct kbasep_js_policy_cfs_job - per job information for CFS
  63. * @ticks: number of ticks that this job has been executing for
  64. *
  65. * &kbasep_js_device_data.runpool_irq.lock must be held when accessing @ticks.
  66. */
  67. struct kbasep_js_policy_cfs_job {
  68. u32 ticks;
  69. };
  70. #endif // ifndef _KBASE_JS_POLICY_CFS_H_