Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
GHC
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
4,323
Issues
4,323
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
385
Merge Requests
385
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Glasgow Haskell Compiler
GHC
Commits
859ebdd4
Commit
859ebdd4
authored
Jul 13, 2019
by
KevinBuhr
Committed by
Marge Bot
Dec 31, 2019
2
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add "-Iw" RTS flag for minimum wait between idle GCs (
#11134
)
parent
d710fd66
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
63 additions
and
20 deletions
+63
-20
docs/users_guide/runtime_control.rst
docs/users_guide/runtime_control.rst
+20
-0
includes/rts/Flags.h
includes/rts/Flags.h
+1
-0
rts/RtsFlags.c
rts/RtsFlags.c
+28
-13
rts/Timer.c
rts/Timer.c
+14
-7
No files found.
docs/users_guide/runtime_control.rst
View file @
859ebdd4
...
...
@@ -653,6 +653,26 @@ performance.
This is an experimental feature, please let us know if it causes
problems and/or could benefit from further tuning.
.. rts-flag:: -Iw ⟨seconds⟩
:default: 0 seconds
.. index::
single: idle GC
By default, if idle GC is enabled in the threaded runtime, a major
GC will be performed every time the process goes idle for a
sufficiently long duration (see :rts-flag:`-I ⟨seconds⟩`). For
large server processes accepting regular but infrequent requests
(e.g., once per second), an expensive, major GC may run after
every request. As an alternative to shutting off idle GC entirely
(with ``-I0``), a minimum wait time between idle GCs can be
specified with this flag. For example, ``-Iw60`` will ensure that
an idle GC runs at most once per minute.
This is an experimental feature, please let us know if it causes
problems and/or could benefit from further tuning.
.. rts-flag:: -ki ⟨size⟩
:default: 1k
...
...
includes/rts/Flags.h
View file @
859ebdd4
...
...
@@ -66,6 +66,7 @@ typedef struct _GC_FLAGS {
bool
ringBell
;
Time
idleGCDelayTime
;
/* units: TIME_RESOLUTION */
Time
interIdleGCWait
;
/* units: TIME_RESOLUTION */
bool
doIdleGC
;
Time
longGCSync
;
/* units: TIME_RESOLUTION */
...
...
rts/RtsFlags.c
View file @
859ebdd4
...
...
@@ -164,6 +164,7 @@ void initRtsFlagsDefaults(void)
RtsFlags
.
GcFlags
.
compactThreshold
=
30
.
0
;
RtsFlags
.
GcFlags
.
sweep
=
false
;
RtsFlags
.
GcFlags
.
idleGCDelayTime
=
USToTime
(
300000
);
// 300ms
RtsFlags
.
GcFlags
.
interIdleGCWait
=
0
;
#if defined(THREADED_RTS)
RtsFlags
.
GcFlags
.
doIdleGC
=
true
;
#else
...
...
@@ -1179,19 +1180,33 @@ error = true;
break
;
case
'I'
:
/* idle GC delay */
OPTION_UNSAFE
;
if
(
rts_argv
[
arg
][
2
]
==
'\0'
)
{
/* use default */
}
else
{
Time
t
=
fsecondsToTime
(
atof
(
rts_argv
[
arg
]
+
2
));
if
(
t
==
0
)
{
RtsFlags
.
GcFlags
.
doIdleGC
=
false
;
}
else
{
RtsFlags
.
GcFlags
.
doIdleGC
=
true
;
RtsFlags
.
GcFlags
.
idleGCDelayTime
=
t
;
}
}
break
;
OPTION_UNSAFE
;
switch
(
rts_argv
[
arg
][
2
])
{
/* minimum inter-idle GC wait time */
case
'w'
:
if
(
rts_argv
[
arg
][
3
]
==
'\0'
)
{
/* use default */
}
else
{
RtsFlags
.
GcFlags
.
interIdleGCWait
=
fsecondsToTime
(
atof
(
rts_argv
[
arg
]
+
3
));
}
break
;
/* idle delay before GC */
case
'\0'
:
/* use default */
break
;
default:
{
Time
t
=
fsecondsToTime
(
atof
(
rts_argv
[
arg
]
+
2
));
if
(
t
==
0
)
{
RtsFlags
.
GcFlags
.
doIdleGC
=
false
;
}
else
{
RtsFlags
.
GcFlags
.
doIdleGC
=
true
;
RtsFlags
.
GcFlags
.
idleGCDelayTime
=
t
;
}
}
break
;
}
break
;
case
'T'
:
OPTION_SAFE
;
...
...
rts/Timer.c
View file @
859ebdd4
...
...
@@ -28,8 +28,11 @@
/* ticks left before next pre-emptive context switch */
static
int
ticks_to_ctxt_switch
=
0
;
/* idle ticks left before we perform a GC */
static
int
ticks_to_gc
=
0
;
/* idle ticks left before GC allowed */
static
int
idle_ticks_to_gc
=
0
;
/* inter-idle GC ticks left before GC allowed */
static
int
inter_gc_ticks_to_gc
=
0
;
/*
* Function: handle_tick()
...
...
@@ -53,18 +56,21 @@ handle_tick(int unused STG_UNUSED)
/*
* If we've been inactive for idleGCDelayTime (set by +RTS
* -I), tell the scheduler to wake up and do a GC, to check
* for threads that are deadlocked.
* for threads that are deadlocked. However, ensure we wait
* at least interIdleGCWait (+RTS -Iw) between idle GCs.
*/
switch
(
recent_activity
)
{
case
ACTIVITY_YES
:
recent_activity
=
ACTIVITY_MAYBE_NO
;
ticks_to_gc
=
RtsFlags
.
GcFlags
.
idleGCDelayTime
/
RtsFlags
.
MiscFlags
.
tickInterval
;
idle_
ticks_to_gc
=
RtsFlags
.
GcFlags
.
idleGCDelayTime
/
RtsFlags
.
MiscFlags
.
tickInterval
;
break
;
case
ACTIVITY_MAYBE_NO
:
if
(
ticks_to_gc
==
0
)
{
if
(
idle_ticks_to_gc
==
0
&&
inter_gc_
ticks_to_gc
==
0
)
{
if
(
RtsFlags
.
GcFlags
.
doIdleGC
)
{
recent_activity
=
ACTIVITY_INACTIVE
;
inter_gc_ticks_to_gc
=
RtsFlags
.
GcFlags
.
interIdleGCWait
/
RtsFlags
.
MiscFlags
.
tickInterval
;
#if defined(THREADED_RTS)
wakeUpRts
();
// The scheduler will call stopTimer() when it has done
...
...
@@ -86,7 +92,8 @@ handle_tick(int unused STG_UNUSED)
#endif
}
}
else
{
ticks_to_gc
--
;
if
(
idle_ticks_to_gc
)
idle_ticks_to_gc
--
;
if
(
inter_gc_ticks_to_gc
)
inter_gc_ticks_to_gc
--
;
}
break
;
default:
...
...
KevinBuhr
@kabuhr
mentioned in commit
04dce498
·
Jul 08, 2020
mentioned in commit
04dce498
mentioned in commit 04dce49825c5124d942846902d97b42c33ca26e7
Toggle commit list
KevinBuhr
@kabuhr
mentioned in commit
5018cad4
·
Jul 15, 2020
mentioned in commit
5018cad4
mentioned in commit 5018cad4be80f06bd132820d116441ac4e93ac37
Toggle commit list
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment