summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_racct.c
Commit message (Collapse)AuthorAgeFilesLines
* MFC r292384:bdrewery2016-06-271-33/+34
| | | | | | Fix style issues around existing SDT probes. ** Changes to sys/netinet/in_kdtrace.c and sys/netinet/in_kdtrace.h skipped.
* To facillitate an upcoming Linuxulator merging partiallydchagin2016-01-091-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | MFC r275121 (by kib). Only merge the syntax changes from r275121, PROC_*LOCK() macros still lock the same proc spinlock. The process spin lock currently has the following distinct uses: - Threads lifetime cycle, in particular, counting of the threads in the process, and interlocking with process mutex and thread lock. The main reason of this is that turnstile locks are after thread locks, so you e.g. cannot unlock blockable mutex (think process mutex) while owning thread lock. - Virtual and profiling itimers, since the timers activation is done from the clock interrupt context. Replace the p_slock by p_itimmtx and PROC_ITIMLOCK(). - Profiling code (profil(2)), for similar reason. Replace the p_slock by p_profmtx and PROC_PROFLOCK(). - Resource usage accounting. Need for the spinlock there is subtle, my understanding is that spinlock blocks context switching for the current thread, which prevents td_runtime and similar fields from changing (updates are done at the mi_switch()). Replace the p_slock by p_statmtx and PROC_STATLOCK(). Discussed with: kib
* MFC 290662jpaetzel2015-11-201-8/+8
| | | | | | | | | | | | | Fix a bug in the CPU % limiting code If you attempt to set a pcpu limit that is higher than 110% using rctl (for instance, you want a jail to be able to use 2 cores on your system so you set pcpu to 200%) the thing you are trying to limit becomes unthrottled. PR: 189870 Submitted by: dustinwenz@ebureau.com Reviewed by: trasz
* MFC r288336: save some bytes by using more concise SDT_PROBE<n>avg2015-10-231-15/+13
|
* Long overdue MFC r284378:jlh2015-09-221-12/+12
| | | | | | nit: Rename racct_alloc_resource to racct_adjust_resource. This is more accurate as the amount can be negative.
* Make the kern.racct.tunable actually work.trasz2015-08-051-0/+1
| | | | | | | | This is a direct commit to 10-STABLE - 11-CURRENT is not affected, because tunables are automatically fetched there. MFC after: ASAP Sponsored by: The FreeBSD Foundation
* MFC r282213:trasz2015-06-211-1/+97
| | | | | | | | | | | | | | | | | | Add kern.racct.enable tunable and RACCT_DISABLED config option. The point of this is to be able to add RACCT (with RACCT_DISABLED) to GENERIC, to avoid having to rebuild the kernel to use rctl(8). MFC r282901: Build GENERIC with RACCT/RCTL support by default. Note that it still needs to be enabled by adding "kern.racct.enable=1" to /boot/loader.conf. Note those two are MFC-ed together, because the latter one changes the name of RACCT_DISABLED option to RACCT_DEFAULT_TO_DISABLED. Should have committed the renaming separately... Relnotes: yes Sponsored by: The FreeBSD Foundation
* MFC r258622: dtrace sdt: remove the ugly sname parameter of SDT_PROBE_DEFINEavg2014-01-171-18/+18
|
* Accessing td_state requires thread lock to be held.trasz2013-03-141-4/+2
| | | | | Submitted by: Rudo Tomori Reviewed by: kib
* Improve KASSERT messages in racct, to make it clear which resourcetrasz2012-11-151-12/+17
| | | | | | caused the problem. Submitted by: mjg
* Fix kassert that's not really valid for %CPU accounting. The problemtrasz2012-11-151-2/+3
| | | | | | | | here is race between decaying the resource usage in containers, and updating per-process usage; basically, the former may cause per-container usage to get smaller than per-process usage. Submitted by: Rudo Tomori
* Don't divide by zero.trasz2012-11-131-6/+12
| | | | Tested by: swills
* Add CPU percentage limit enforcement to RCTL. The resouce name is "pcpu".trasz2012-10-261-29/+468
| | | | It was implemented by Rudolf Tomori during Google Summer of Code 2012.
* Fix panic with RACCT that could occur in low memory (or out of swap)trasz2012-05-221-0/+3
| | | | | | | | situations, due to fork1() calling racct_proc_exit() without calling racct_proc_fork() first. Submitted by: Mateusz Guzik <mjguzik at gmail dot com> (earlier version) Reviewed by: Mateusz Guzik <mjguzik at gmail dot com>
* Stop treating system processes as special. This fixes panicstrasz2012-04-171-23/+0
| | | | | | | | | | | | | | | | | | | | | | | | like the one triggered by this: # kldload geom_vinum # pwait `pgrep -S gv_worker` & # kldunload geom_vinum or this: GEOM_JOURNAL: Shutting down geom gjournal 3464572051. panic: destroying non-empty racct: 1 allocated for resource 6 which were tracked by jh@ to be caused by checking p->p_flag, while it wasn't initialised yet. Basically, during fork, the code checked p_flag, concluded the process isn't marked as P_SYSTEM, incremented the counter, and later on, when exiting, checked that the process was marked as P_SYSTEM, and thus didn't decrement it. Also, I believe there wasn't any good reason for checking P_SYSTEM in the first place. Tested by: jh
* Cast wallclock.tv_sec to uint64_t to avoid overflow in the calculation.jh2012-03-181-1/+2
| | | | | | | PR: kern/161552 Reviewed by: trasz Tested by: Nikos Vassiliadis MFC after: 1 week
* Remove useless thread_{lock,unlock}() in raccd.trasz2012-03-101-4/+1
|
* Make racct and rctl correctly handle jail renaming. Previouslytrasz2012-03-061-0/+12
| | | | | | they would continue using old name, the one jail was created with. PR: bin/165207
* kern_racct: move sys/systm.h inclusion to its proper placeavg2011-12-121-2/+1
| | | | | | | | This should fix the build failure introduced with r228424. Also remove duplicate inclusion of sys/param.h. Pointyhat to: avg MFC after: 1 week
* Actually enforce limit for inheritable resources on fork.trasz2011-10-041-6/+6
| | | | MFC after: 3 days
* Move some code inside the racct_proc_fork(); it spares a few lock operationstrasz2011-10-031-9/+22
| | | | | | and it's more logical this way. MFC after: 3 days
* Fix another bug introduced in r225641, which caused rctl to access certaintrasz2011-10-031-0/+23
| | | | | | fields in 'struct proc' before they got initialized in do_fork(). MFC after: 3 days
* Fix bug introduced in r225641, which would cause panic if racct_proc_fork()trasz2011-10-031-18/+1
| | | | | | returned error -- the racct_destroy_locked() would get called twice. MFC after: 3 days
* Fix panic that happens when fork(2) fails due to a limit other thantrasz2011-09-031-7/+12
| | | | | | | the rctl one - for example, it happens when someone reaches maximum number of processes in the system. Approved by: re (kib)
* Rename resource names to match these in login.conf.trasz2011-07-141-2/+2
|
* Style fix - macros are supposed to be uppercase.trasz2011-07-071-12/+12
|
* Remove definitions for RACCT_FSIZE and RACCT_SBSIZE - these two are rathertrasz2011-05-271-5/+0
| | | | | performance-sensitive and not that useful, so I won't be merging them before 9.0.
* Change the way rctl interfaces with jails by introducing prison_raccttrasz2011-05-031-5/+9
| | | | | | structure, which acts as a proxy between them. This makes jail rules persistent, i.e. they can be added before jail gets created, and they don't disappear when the jail gets destroyed.
* Add missing stubs.trasz2011-04-051-0/+12
|
* Remove pointless (always true) KASSERTs.trasz2011-03-291-19/+0
| | | | Submitted by: pjd
* Add racct. It's an API to keep per-process, per-jail, per-loginclasstrasz2011-03-291-0/+837
and per-loginclass resource accounting information, to be used by the new resource limits code. It's connected to the build, but the code that actually calls the new functions will come later. Sponsored by: The FreeBSD Foundation Reviewed by: kib (earlier version)
OpenPOWER on IntegriCloud