| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
| |
Reported by: kib
MFC after: 1 week
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- Add a flag which cleanly indicates that a given process is the system
idle process.
- Modify racctd() to skip over the idle proc when aggregating CPU time
and other metrics which don't apply to the idle thread.
- Remove handling for idle threads from racct_getpcpu().
PR: 269097
Reviewed by: olce, kib
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D50073
|
|
|
|
|
|
|
|
|
|
|
|
| |
- Remove most checks of the P_INMEM flag.
- Some uses remain since a few userspace tools, e.g., ps(1) and top(1)
expect the flag to be set. These can be cleaned up but the code has
most likely been copy-pasted elsewhere and while linger for a long
time.
Tested by: pho
Reviewed by: alc, imp, kib
Differential Revision: https://reviews.freebsd.org/D46117
|
|
|
|
|
|
|
|
|
|
| |
Just skip compiling this file if RACCT isn't defined. This allows to
skip including headers that no code uses at all, and also to remove the
whole file's #ifdef/#endif bracketing.
Reviewed by: markj
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
|
|
|
|
| |
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
|
|
|
|
| |
Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
|
|
|
|
|
|
|
|
|
| |
The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch
up to that fact and revert to their recommended match of BSD-2-Clause.
Discussed with: pfg
MFC After: 3 days
Sponsored by: Netflix
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Make most AST handlers dynamically registered. This allows to have
subsystem-specific handler source located in the subsystem files,
instead of making subr_trap.c aware of it. For instance, signal
delivery code on return to userspace is now moved to kern_sig.c.
Also, it allows to have some handlers designated as the cleanup (kclear)
type, which are called both at AST and on thread/process exit. For
instance, ast(), exit1(), and NFS server no longer need to be aware
about UFS softdep processing.
The dynamic registration also allows third-party modules to register AST
handlers if needed. There is one caveat with loadable modules: the
code does not make any effort to ensure that the module is not unloaded
before all threads processed through AST handler in it. In fact, this
is already present behavior for hwpmc.ko and ufs.ko. I do not think it
is worth the efforts and the runtime overhead to try to fix it.
Reviewed by: markj
Tested by: emaste (arm64), pho
Discussed with: jhb
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D35888
|
|
|
|
|
|
| |
Where appropriate hide sysent.h under proper condition.
MFC after: 2 weeks
|
|
|
|
|
|
| |
- s/maxumum/maximum/
MFC after: 3 days
|
|
|
|
|
|
|
|
|
|
|
|
| |
To prevent umtx.h polluting by future changes split it on two headers:
umtx.h - ABI header for userspace;
umtxvar.h - the kernel staff.
While here fix umtx_key_match style.
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D31248
MFC after: 2 weeks
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
KCSAN complains about racy accesses in the locking code. Those races are
fine since they are inside a TD_SET_RUNNING() loop that expects the value
to be changed by another CPU.
Use relaxed atomic stores/loads to indicate that this variable can be
written/read by multiple CPUs at the same time. This will also prevent
the compiler from doing unexpected re-ordering.
Reported by: GENERIC-KCSAN
Test Plan: KCSAN no longer complains, kernel still runs fine.
Reviewed By: markj, mjg (earlier version)
Differential Revision: https://reviews.freebsd.org/D28569
|
|
|
|
|
|
|
|
|
|
|
|
| |
Foundation copyrights, approved by emaste@. It does not include
files which carry other people's copyrights; if you're one
of those people, feel free to make similar change.
Reviewed by: emaste, imp, gbe (manpages)
Differential Revision: https://reviews.freebsd.org/D26980
Notes:
svn path=/head/; revision=367105
|
|
|
|
|
|
|
|
|
|
|
|
| |
for it to sit in the syscall fast path.
Reviewed by: kib
MFC after: 2 weeks
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D26368
Notes:
svn path=/head/; revision=365710
|
|
|
|
| |
Notes:
svn path=/head/; revision=365222
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
r357614 added CTLFLAG_NEEDGIANT to make it easier to find nodes that are
still not MPSAFE (or already are but aren’t properly marked).
Use it in preparation for a general review of all nodes.
This is non-functional change that adds annotations to SYSCTL_NODE and
SYSCTL_PROC nodes using one of the soon-to-be-required flags.
Mark all obvious cases as MPSAFE. All entries that haven't been marked
as MPSAFE before are by default marked as NEEDGIANT
Approved by: kib (mentor, blanket)
Commented by: kib, gallatin, melifaro
Differential Revision: https://reviews.freebsd.org/D23718
Notes:
svn path=/head/; revision=358333
|
|
|
|
|
|
|
|
|
|
|
|
| |
It is not needed by anything in the kernel and it slightly drives up contention
on both proctree and allproc locks.
Reviewed by: kib
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D21447
Notes:
svn path=/head/; revision=351572
|
|
|
|
|
|
|
|
|
|
| |
This allows to remove PROC_LOCK/UNLOCK pairs spread thorought the kernel
only used to appease racct_set.
Sponsored by: The FreeBSD Foundation
Notes:
svn path=/head/; revision=341701
|
|
|
|
|
|
|
| |
Sponsored by: The FreeBSD Foundation
Notes:
svn path=/head/; revision=341182
|
|
|
|
|
|
|
|
|
|
|
|
| |
racct is not enabled by default and even when it is enabled processes are
typically not throttled. The order of checks is left unchanged since
racct_enable will be annotated as __read_frequently, while checking for the
flag in the processes would probably require an extra fetch.
Sponsored by: The FreeBSD Foundation
Notes:
svn path=/head/; revision=341181
|
|
|
|
|
|
|
|
|
|
|
|
| |
waitpid always takes proctree to evaluate the list, but only takes allproc
if it can reap. With this patch allproc is no longer taken, which helps during
poudriere -j 128.
Discussed with: kib
Sponsored by: The FreeBSD Foundation
Notes:
svn path=/head/; revision=341176
|
|
|
|
|
|
|
|
|
|
| |
We don't have to access the process after making it runnable, so there
is no need to hold it either.
Sponsored by: The FreeBSD Foundation
Notes:
svn path=/head/; revision=340785
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The lock is required to ensure that the switch to the new credentials
and the transfer of the process's accounting data from the old
credentials to the new ones is done atomically. Otherwise, some updates
may be applied to the new credentials and then additionally transferred
from the old credentials if the updates happen after proc_set_cred() and
before racct_proc_ucred_changed().
The problem is especially pronounced for RACCT_RSS because
- there is a strict accounting for this resource (it's reclaimable)
- it's updated asynchronously by the vm daemon
- it's updated by setting an absolute value instead of applying a delta
I had to remove a call to rctl_proc_ucred_changed() from
racct_proc_ucred_changed() and make all callers of latter call the
former as well. The reason is that rctl_proc_ucred_changed, as it is
implemented now, cannot be called while holding the proc lock, so the
lock is dropped after calling racct_proc_ucred_changed. Additionally,
I've added calls to crhold / crfree around the rctl call, because
without the proc lock there is no gurantee that the new credentials,
owned by the process, will stay stable. That does not eliminate a
possibility that the credentials passed to the rctl will get stale.
Ideally, rctl_proc_ucred_changed should be able to work under the proc
lock.
Many thanks to kib for pointing out the above problems.
PR: 222027
Discussed with: kib
No comment: trasz
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D15048
Notes:
svn path=/head/; revision=332816
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.
The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.
Notes:
svn path=/head/; revision=326271
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There could be a race between the vm daemon setting RACCT_RSS based on
the vm space and vmspace_exit (called from exit1) resetting RACCT_RSS to
zero. In that case we can get a zombie process with non-zero RACCT_RSS.
If the process is jailed, that may break accounting for the jail.
There could be other consequences.
Fix this race in the vm daemon by updating RACCT_RSS only when a process
is in the normal state. Also, make accounting a little bit more
accurate by refreshing the page resident count after calling
vm_pageout_map_deactivate_pages().
Finally, add an assert that the RSS is zero when a process is reaped.
PR: 210315
Reviewed by: trasz
Differential Revision: https://reviews.freebsd.org/D9464
Notes:
svn path=/head/; revision=313730
|
|
|
|
| |
Notes:
svn path=/head/; revision=312623
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
already required both of them, so having a separate rctl_lock didn't
buy us anything.
Reviewed by: mjg@
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D5914
Notes:
svn path=/head/; revision=298414
|
|
|
|
|
|
|
|
|
|
| |
in the first place.
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Notes:
svn path=/head/; revision=298050
|
|
|
|
|
|
|
|
| |
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Notes:
svn path=/head/; revision=298045
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
for limiting disk (actually filesystem) IO.
Note that in some cases these limits are not quite precise. It's ok,
as long as it's within some reasonable bounds.
Testing - and review of the code, in particular the VFS and VM parts - is
very welcome.
MFC after: 1 month
Relnotes: yes
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D5080
Notes:
svn path=/head/; revision=297633
|
|
|
|
|
|
|
|
| |
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Notes:
svn path=/head/; revision=297578
|
|
|
|
|
|
|
|
| |
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Notes:
svn path=/head/; revision=297495
|
|
|
|
|
|
|
|
|
|
| |
to iterate separately for each resource.
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Notes:
svn path=/head/; revision=297494
|
|
|
|
|
|
|
|
|
|
|
| |
from racct_*_force() functions. It makes the "log" and "devctl" actions work
in those cases.
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Notes:
svn path=/head/; revision=297492
|
|
|
|
|
|
|
|
| |
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Notes:
svn path=/head/; revision=297491
|
|
|
|
|
|
|
|
| |
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Notes:
svn path=/head/; revision=297490
|
|
|
|
|
|
|
|
| |
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Notes:
svn path=/head/; revision=297489
|
|
|
|
|
|
|
|
|
|
|
| |
I left as is an apparent bug in ntoskrnl_var.h:AT_PASSIVE_LEVEL()
definition.
Suggested by: jhb
Sponsored by: The FreeBSD Foundation
Notes:
svn path=/head/; revision=295435
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
fork1 required its callers to pass a pointer to struct proc * which would
be set to the new process (if any). procdesc and racct manipulation also
used said pointer.
However, the process could have exited prior to do_fork return and be
automatically reaped, thus making this a use-after-free.
Fix the problem by letting callers indicate whether they want the pid or
the struct proc, return the process in stopped state for the latter case.
Reviewed by: kib
Notes:
svn path=/head/; revision=295233
|
|
|
|
|
|
|
|
|
|
|
|
| |
- Use SDT_PROBE<N>() instead of SDT_PROBE(). This has no functional effect
at the moment, but will be needed for some future changes.
- Don't hardcode the module component of the probe identifier. This is
set automatically by the SDT framework.
MFC after: 1 week
Notes:
svn path=/head/; revision=292384
|
|
|
|
|
|
|
|
| |
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Notes:
svn path=/head/; revision=292162
|
|
|
|
|
|
|
|
|
|
| |
as it was always supposed to be.
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Notes:
svn path=/head/; revision=292161
|
|
|
|
|
|
|
|
| |
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Notes:
svn path=/head/; revision=292160
|
|
|
|
|
|
|
|
|
|
|
|
| |
during iteration instead of relocking it for each traversed rule.
Reviewed by: mjg@
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D4110
Notes:
svn path=/head/; revision=290857
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 after: 1 week
Notes:
svn path=/head/; revision=290662
|
|
|
|
|
|
|
|
|
|
|
|
| |
SDT_PROBE requires 5 parameters whereas SDT_PROBE<n> requires n parameters
where n is typically smaller than 5.
Perhaps SDT_PROBE should be made a private implementation detail.
MFC after: 20 days
Notes:
svn path=/head/; revision=288336
|
|
|
|
|
|
|
|
|
| |
This is more accurate as the amount can be negative.
MFC after: 2 weeks
Notes:
svn path=/head/; revision=284378
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
needs to be enabled by adding "kern.racct.enable=1" to /boot/loader.conf.
Differential Revision: https://reviews.freebsd.org/D2407
Reviewed by: emaste@, wblock@
MFC after: 1 month
Relnotes: yes
Sponsored by: The FreeBSD Foundation
Notes:
svn path=/head/; revision=282901
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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).
Differential Revision: https://reviews.freebsd.org/D2369
Reviewed by: kib@
MFC after: 1 month
Relnotes: yes
Sponsored by: The FreeBSD Foundation
Notes:
svn path=/head/; revision=282213
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- 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().
The split is done mostly for code clarity, and should not affect
scalability.
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Notes:
svn path=/head/; revision=275121
|