[Vm-dev] [commit][2740] Add the linux policy change dance to
sqUnixVMProfile.c ( cf sqUnixHeartbeat.c).
commits at squeakvm.org
commits at squeakvm.org
Tue Jun 11 20:12:33 UTC 2013
Revision: 2740
Author: eliot
Date: 2013-06-11 13:12:31 -0700 (Tue, 11 Jun 2013)
Log Message:
-----------
Add the linux policy change dance to sqUnixVMProfile.c (cf sqUnixHeartbeat.c).
Fix a bail_out typo.
Modified Paths:
--------------
branches/Cog/platforms/unix/vm/sqUnixVMProfile.c
Property Changed:
----------------
branches/Cog/platforms/Cross/vm/sqSCCSVersion.h
Property changes on: branches/Cog/platforms/Cross/vm/sqSCCSVersion.h
___________________________________________________________________
Modified: checkindate
- Mon Jun 10 18:15:11 PDT 2013
+ Tue Jun 11 13:11:09 PDT 2013
Modified: branches/Cog/platforms/unix/vm/sqUnixVMProfile.c
===================================================================
--- branches/Cog/platforms/unix/vm/sqUnixVMProfile.c 2013-06-11 01:16:01 UTC (rev 2739)
+++ branches/Cog/platforms/unix/vm/sqUnixVMProfile.c 2013-06-11 20:12:31 UTC (rev 2740)
@@ -47,8 +47,8 @@
#if __linux__
# if !defined(__USE_GNU)
# define UNDEF__USE_GNU 1
+# define __USE_GNU /* to get register defines in sys/ucontext.h */
# endif
-# define __USE_GNU /* to get register defines in sys/ucontext.h */
#endif
#include <sys/ucontext.h>
#if __linux__ && UNDEF__USE_GNU
@@ -111,7 +111,7 @@
if ((er = pthread_setschedparam(pthread_self(),
profThreadPolicy,
&profThreadPriority)))
- bail_out(er,"pthread_getschedparam failed");
+ bail_out(er,"pthread_setschedparam failed");
profileState = quiescent;
while (profileState != dead) {
@@ -229,6 +229,11 @@
* want to profile.
*/
profThreadPriority.sched_priority += 2;
+ /* If the priority isn't appropriate for the policy (typically SCHED_OTHER)
+ * then change policy.
+ */
+ if (sched_get_priority_max(profThreadPolicy) < profThreadPriority.sched_priority)
+ profThreadPolicy = SCHED_FIFO;
profileState = nascent;
if ((er= pthread_create(&careLess,
(const pthread_attr_t *)0,
@@ -340,6 +345,11 @@
* want to profile.
*/
profThreadPriority.sched_priority += 2;
+ /* If the priority isn't appropriate for the policy (typically SCHED_OTHER)
+ * then change policy.
+ */
+ if (sched_get_priority_max(profThreadPolicy) < profThreadPriority.sched_priority)
+ profThreadPolicy = SCHED_FIFO;
profileState = nascent;
if ((er= pthread_create(&careLess,
(const pthread_attr_t *)0,
More information about the Vm-dev
mailing list