Date: Mon, 11 Jan 2021 23:37:32 GMT From: "Jason A. Harmening" <jah@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: e8a5a1ad7154 - main - rctl(4): support throttling resource usage to 0 Message-ID: <202101112337.10BNbWtC050024@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by jah: URL: https://cgit.FreeBSD.org/src/commit/?id=e8a5a1ad7154dc34e3a5234267e19faa86d5ff33 commit e8a5a1ad7154dc34e3a5234267e19faa86d5ff33 Author: Jason A. Harmening <jah@FreeBSD.org> AuthorDate: 2020-12-30 23:29:44 +0000 Commit: Jason A. Harmening <jah@FreeBSD.org> CommitDate: 2021-01-11 23:36:57 +0000 rctl(4): support throttling resource usage to 0 For rate-based resources that support throttling (e.g. readiops/writeips), this fixes a divide-by-zero panic when rctl(8) passes 0 as the throttle value. For these resources, treat zero-throttle requests as requests to suspend forward progress as long as possible using the duration specified in kern.racct.rctl.throttle_max. PR: 251803 Reported by: chris@cretaforce.gr Reviewed by: kib MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D27858 --- sys/kern/kern_rctl.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sys/kern/kern_rctl.c b/sys/kern/kern_rctl.c index 9a0e0651750f..90e2f7832691 100644 --- a/sys/kern/kern_rctl.c +++ b/sys/kern/kern_rctl.c @@ -600,6 +600,11 @@ rctl_enforce(struct proc *p, int resource, uint64_t amount) if (p->p_state != PRS_NORMAL) continue; + if (rule->rr_amount == 0) { + racct_proc_throttle(p, rctl_throttle_max); + continue; + } + /* * Make the process sleep for a fraction of second * proportional to the ratio of process' resource
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202101112337.10BNbWtC050024>