NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
kern/55166: uvm_pdpolicy_clock params (anon/exec/file max/min) defaults
>Number: 55166
>Category: kern
>Synopsis: uvm_pdpolicy_clock params (anon/exec/file max/min) defaults
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: kern-bug-people
>State: open
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Sat Apr 11 16:40:00 +0000 2020
>Originator: Izumi Tsutsui
>Release: NetBSD 9.0
>Organization:
>Environment:
System: NetBSD 9.0
Architecture: all
Machine: all
>Description:
In sys/uvm/uvm_pdpolicy_clock.c, "anonmax", "anonmin", "fileman",
"filemin", "execmax" and "execmin" parameter is used to manage
kernel physical pages.
There parameters can be changed by sysctl(8), but initial values
are hardcorded in uvmpdpol_init():
---
void
uvmpdpol_init(void)
{
struct uvmpdpol_globalstate *s = &pdpol_state;
TAILQ_INIT(&s->s_activeq);
TAILQ_INIT(&s->s_inactiveq);
uvm_pctparam_init(&s->s_inactivepct, CLOCK_INACTIVEPCT, NULL);
uvm_pctparam_init(&s->s_anonmin, 10, min_check);
uvm_pctparam_init(&s->s_filemin, 10, min_check);
uvm_pctparam_init(&s->s_execmin, 5, min_check);
uvm_pctparam_init(&s->s_anonmax, 80, NULL);
uvm_pctparam_init(&s->s_filemax, 50, NULL);
uvm_pctparam_init(&s->s_execmax, 30, NULL);
}
---
(not sure how these values are optimized, btw)
On several machines that have less than 16MB RAM
(dreamcast, x68k, LUNA-I on luna68k etc.) behaves
quite badly (probably due to excessive thrashing?)
with these default parameters.
Using the following sysctl vm values on dreamcast and x68k
makes many applications (including twitter/mastodon clients)
work as they can be used as demonstrations at conferences:
---
vm.anonmax=30
vm.anonmin=10
vm.execmax=50
vm.execmin=20
vm.filemax=1
vm.filemin=0
---
Several ports (dreamcast etc.) has an upper limit of RAMs,
so it's worth to override these default vm values in
kernel config files or conf/std.${MACHINE} files.
>How-To-Repeat:
Code inspection.
>Fix:
Replace these immediate default values with proper macro
as existing CLOCK_INACTIVEPCT:
---
Index: sys/uvm/uvm_pdpolicy_clock.c
===================================================================
RCS file: /cvsroot/src/sys/uvm/uvm_pdpolicy_clock.c,v
retrieving revision 1.17
diff -u -p -d -r1.17 uvm_pdpolicy_clock.c
--- sys/uvm/uvm_pdpolicy_clock.c 30 Jan 2012 17:21:52 -0000 1.17
+++ sys/uvm/uvm_pdpolicy_clock.c 11 Apr 2020 16:20:24 -0000
@@ -89,6 +89,30 @@ __KERNEL_RCSID(0, "$NetBSD: uvm_pdpolicy
#define CLOCK_INACTIVEPCT 33
#endif /* !defined(CLOCK_INACTIVEPCT) */
+#if !defined(CLOCK_ANONMIN)
+#define CLOCK_ANONMIN 10
+#endif /* !defined(CLOCK_ANONMIN) */
+
+#if !defined(CLOCK_FILEMIN)
+#define CLOCK_FILEMIN 10
+#endif /* !defined(CLOCK_FILEMIN) */
+
+#if !defined(CLOCK_EXECMIN)
+#define CLOCK_EXECMIN 5
+#endif /* !defined(CLOCK_EXECMIN) */
+
+#if !defined(CLOCK_ANONMAX)
+#define CLOCK_ANONMAX 80
+#endif /* !defined(CLOCK_ANONMAX) */
+
+#if !defined(CLOCK_FILEMAX)
+#define CLOCK_FILEMAX 50
+#endif /* !defined(CLOCK_FILEMAX) */
+
+#if !defined(CLOCK_EXECMAX)
+#define CLOCK_EXECMAX 30
+#endif /* !defined(CLOCK_EXECMAX) */
+
struct uvmpdpol_globalstate {
struct pglist s_activeq; /* allocated pages, in use */
struct pglist s_inactiveq; /* pages between the clock hands */
@@ -403,12 +427,12 @@ uvmpdpol_init(void)
TAILQ_INIT(&s->s_activeq);
TAILQ_INIT(&s->s_inactiveq);
uvm_pctparam_init(&s->s_inactivepct, CLOCK_INACTIVEPCT, NULL);
- uvm_pctparam_init(&s->s_anonmin, 10, min_check);
- uvm_pctparam_init(&s->s_filemin, 10, min_check);
- uvm_pctparam_init(&s->s_execmin, 5, min_check);
- uvm_pctparam_init(&s->s_anonmax, 80, NULL);
- uvm_pctparam_init(&s->s_filemax, 50, NULL);
- uvm_pctparam_init(&s->s_execmax, 30, NULL);
+ uvm_pctparam_init(&s->s_anonmin, CLOCK_ANONMIN, min_check);
+ uvm_pctparam_init(&s->s_filemin, CLOCK_FILEMIN, min_check);
+ uvm_pctparam_init(&s->s_execmin, CLOCK_EXECMIN, min_check);
+ uvm_pctparam_init(&s->s_anonmax, CLOCK_ANONMAX, NULL);
+ uvm_pctparam_init(&s->s_filemax, CLOCK_FILEMAX, NULL);
+ uvm_pctparam_init(&s->s_execmax, CLOCK_EXECMAX, NULL);
}
void
---
Izumi Tsutsui
Home |
Main Index |
Thread Index |
Old Index