Page MenuHomeFreeBSD
Paste P601

git -C /usr/src stash push --message "D40045, demandoc, tslog"
ActivePublic

Authored by grahamperrin on Aug 6 2023, 2:42 PM.
<https://lists.freebsd.org/archives/freebsd-hackers/2023-August/002437.html>
% git -C /usr/src apply -v /home/grahamperrin/Documents/IT/BSD/FreeBSD/D40045/D40045.diff
Checking patch sys/kern/sched_ule.c...
Checking patch sys/sys/proc.h...
Hunk #1 succeeded at 395 (offset 2 lines).
Applied patch sys/kern/sched_ule.c cleanly.
Applied patch sys/sys/proc.h cleanly.
% nano /usr/src/sys/amd64/conf/GENERIC
% git -C /usr/src add .
% git -C /usr/src status
On branch main
Your branch is up to date with 'origin/main'.
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
modified: sys/amd64/conf/GENERIC
modified: sys/kern/sched_ule.c
modified: sys/sys/proc.h
modified: usr.bin/Makefile
new file: usr.bin/demandoc/Makefile
It took 4.81 seconds to enumerate untracked files.
See 'git help status' for information on how to improve this.
% git -C /usr/src stash push --message "D40045, demandoc, tslog"
Saved working directory and index state On main: D40045, demandoc, tslog
% git -C /usr/src status
On branch main
Your branch is up to date with 'origin/main'.
It took 3.09 seconds to enumerate untracked files.
See 'git help status' for information on how to improve this.
nothing to commit, working tree clean
% git -C /usr/src stash list
stash@{0}: On main: D40045, demandoc, tslog
% git -C /usr/src stash show 0
sys/amd64/conf/GENERIC | 2 ++
sys/kern/sched_ule.c | 16 +++++++++++++++-
sys/sys/proc.h | 2 +-
usr.bin/Makefile | 1 +
usr.bin/demandoc/Makefile | 43 +++++++++++++++++++++++++++++++++++++++++++
5 files changed, 62 insertions(+), 2 deletions(-)
% git -C /usr/src stash show -p 0
diff --git a/sys/amd64/conf/GENERIC b/sys/amd64/conf/GENERIC
index feec1d5dd3c8..c7354f64ba6d 100644
--- a/sys/amd64/conf/GENERIC
+++ b/sys/amd64/conf/GENERIC
@@ -397,3 +397,5 @@ device uinput # install /dev/uinput cdev
options HID_DEBUG # enable debug msgs
device hid # Generic HID support
options IICHID_SAMPLING # Workaround missing GPIO INTR support
+
+options TSLOG
diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c
index 3cd45fc5277d..6057367ae81e 100644
--- a/sys/kern/sched_ule.c
+++ b/sys/kern/sched_ule.c
@@ -95,6 +95,7 @@ struct td_sched {
int ts_cpu; /* CPU that we have affinity for. */
int ts_rltick; /* Real last tick, for affinity. */
int ts_slice; /* Ticks of slice remaining. */
+ int ts_usedslice;
u_int ts_slptime; /* Number of ticks we vol. slept */
u_int ts_runtime; /* Number of ticks we were running */
int ts_ltick; /* Last tick that we were running on */
@@ -212,11 +213,12 @@ static int __read_mostly tickincr = 8 << SCHED_TICK_SHIFT;
static int __read_mostly realstathz = 127; /* reset during boot. */
static int __read_mostly sched_slice = 10; /* reset during boot. */
static int __read_mostly sched_slice_min = 1; /* reset during boot. */
+static bool __read_mostly sched_pick_short = true;
#ifdef PREEMPTION
#ifdef FULL_PREEMPTION
static int __read_mostly preempt_thresh = PRI_MAX_IDLE;
#else
-static int __read_mostly preempt_thresh = PRI_MIN_KERN;
+static int __read_mostly preempt_thresh = PRI_MAX_TIMESHARE + 1;
#endif
#else
static int __read_mostly preempt_thresh = 0;
@@ -340,6 +342,7 @@ static __inline void tdq_runq_rem(struct tdq *, struct thread *);
static inline int sched_shouldpreempt(int, int, int);
static void tdq_print(int cpu);
static void runq_print(struct runq *rq);
+static inline int td_slice(struct thread *td, struct tdq *tdq);
static int tdq_add(struct tdq *, struct thread *, int);
#ifdef SMP
static int tdq_move(struct tdq *, struct tdq *);
@@ -495,6 +498,12 @@ tdq_runq_add(struct tdq *tdq, struct thread *td, int flags)
if (pri < PRI_MIN_BATCH) {
ts->ts_runq = &tdq->tdq_realtime;
} else if (pri <= PRI_MAX_BATCH) {
+ if (sched_pick_short && ts->ts_usedslice < td_slice(td, tdq)) {
+ ts->ts_runq = &tdq->tdq_realtime;
+ runq_add(ts->ts_runq, td, flags);
+ return;
+ }
+
ts->ts_runq = &tdq->tdq_timeshare;
KASSERT(pri <= PRI_MAX_BATCH && pri >= PRI_MIN_BATCH,
("Invalid priority %d on timeshare runq", pri));
@@ -1779,6 +1788,7 @@ schedinit(void)
ts0->ts_ltick = ticks;
ts0->ts_ftick = ticks;
ts0->ts_slice = 0;
+ ts0->ts_usedslice = 0;
ts0->ts_cpu = curcpu; /* set valid CPU number */
}
@@ -2298,6 +2308,7 @@ sched_switch(struct thread *td, int flags)
cpu_switch(td, newtd, mtx);
cpuid = td->td_oncpu = PCPU_GET(cpuid);
+ ts->ts_usedslice = 0;
SDT_PROBE0(sched, , , on__cpu);
#ifdef HWPMC_HOOKS
if (PMC_PROC_IS_USING_PMCS(td->td_proc))
@@ -2632,6 +2643,7 @@ sched_clock(struct thread *td, int cnt)
* time slice (default is 100ms).
*/
ts->ts_slice += cnt;
+ ts->ts_usedslice += cnt;
if (ts->ts_slice >= td_slice(td, tdq)) {
ts->ts_slice = 0;
@@ -3333,6 +3345,8 @@ SYSCTL_INT(_kern_sched, OID_AUTO, idlespins, CTLFLAG_RW, &sched_idlespins, 0,
SYSCTL_INT(_kern_sched, OID_AUTO, idlespinthresh, CTLFLAG_RW,
&sched_idlespinthresh, 0,
"Threshold before we will permit idle thread spinning");
+SYSCTL_BOOL(_kern_sched, OID_AUTO, pick_short, CTLFLAG_RW,
+ &sched_pick_short, 0, "");
#ifdef SMP
SYSCTL_INT(_kern_sched, OID_AUTO, affinity, CTLFLAG_RW, &affinity, 0,
"Number of hz ticks to keep thread affinity for");
diff --git a/sys/sys/proc.h b/sys/sys/proc.h
index d79b7a440168..9ceed74c7255 100644
--- a/sys/sys/proc.h
+++ b/sys/sys/proc.h
@@ -395,7 +395,7 @@ struct thread {
struct thread0_storage {
struct thread t0st_thread;
- uint64_t t0st_sched[10];
+ uint64_t t0st_sched[12];
};
struct mtx *thread_lock_block(struct thread *);
diff --git a/usr.bin/Makefile b/usr.bin/Makefile
index e027eaf81f24..1966d610a8b1 100644
--- a/usr.bin/Makefile
+++ b/usr.bin/Makefile
@@ -32,6 +32,7 @@ SUBDIR= alias \
csplit \
ctlstat \
cut \
+ demandoc \
diff \
dirname \
dtc \
diff --git a/usr.bin/demandoc/Makefile b/usr.bin/demandoc/Makefile
new file mode 100644
index 000000000000..00aaa6917f22
--- /dev/null
+++ b/usr.bin/demandoc/Makefile
@@ -0,0 +1,43 @@
+.PATH: ${SRCTOP}/contrib/mandoc
+
+PROG= demandoc
+
+WARNS?= 1
+CFLAGS+= -I${SRCTOP}/lib/libopenbsd
+
+SRCS+= arch.c
+SRCS+= att.c
+SRCS+= chars.c
+SRCS+= compat_recallocarray.c
+SRCS+= demandoc.c
+SRCS+= eqn.c
+SRCS+= lib.c
+SRCS+= man.c
+SRCS+= man_macro.c
+SRCS+= man_validate.c
+SRCS+= mandoc.c
+SRCS+= mandoc_aux.c
+SRCS+= mandoc_msg.c
+SRCS+= mandoc_ohash.c
+SRCS+= mandoc_xr.c
+SRCS+= mdoc.c
+SRCS+= mdoc_argv.c
+SRCS+= mdoc_macro.c
+SRCS+= mdoc_markdown.c
+SRCS+= mdoc_state.c
+SRCS+= mdoc_validate.c
+SRCS+= msec.c
+SRCS+= preconv.c
+SRCS+= read.c
+SRCS+= roff.c
+SRCS+= roff_validate.c
+SRCS+= st.c
+SRCS+= tag.c
+SRCS+= tbl.c
+SRCS+= tbl_data.c
+SRCS+= tbl_layout.c
+SRCS+= tbl_opts.c
+
+LIBADD= openbsd z
+
+.include <bsd.prog.mk>
%

Event Timeline

grahamperrin created this object in space S1 Global.
grahamperrin created this object with edit policy "No One".