Files
linux/Documentation/core-api/index.rst
Maarten Lankhorst b168ed458d kernel/cgroup: Add "dmem" memory accounting cgroup
This code is based on the RDMA and misc cgroup initially, but now
uses page_counter. It uses the same min/low/max semantics as the memory
cgroup as a result.

There's a small mismatch as TTM uses u64, and page_counter long pages.
In practice it's not a problem. 32-bits systems don't really come with
>=4GB cards and as long as we're consistently wrong with units, it's
fine. The device page size may not be in the same units as kernel page
size, and each region might also have a different page size (VRAM vs GART
for example).

The interface is simple:
- Call dmem_cgroup_register_region()
- Use dmem_cgroup_try_charge to check if you can allocate a chunk of memory,
  use dmem_cgroup__uncharge when freeing it. This may return an error code,
  or -EAGAIN when the cgroup limit is reached. In that case a reference
  to the limiting pool is returned.
- The limiting cs can be used as compare function for
  dmem_cgroup_state_evict_valuable.
- After having evicted enough, drop reference to limiting cs with
  dmem_cgroup_pool_state_put.

This API allows you to limit device resources with cgroups.
You can see the supported cards in /sys/fs/cgroup/dmem.capacity
You need to echo +dmem to cgroup.subtree_control, and then you can
partition device memory.

Co-developed-by: Friedrich Vock <friedrich.vock@gmx.de>
Signed-off-by: Friedrich Vock <friedrich.vock@gmx.de>
Co-developed-by: Maxime Ripard <mripard@kernel.org>
Signed-off-by: Maarten Lankhorst <dev@lankhorst.se>
Acked-by: Tejun Heo <tj@kernel.org>
Link: https://lore.kernel.org/r/20241204143112.1250983-1-dev@lankhorst.se
Signed-off-by: Maxime Ripard <mripard@kernel.org>
2025-01-06 17:24:38 +01:00

145 lines
2.4 KiB
ReStructuredText

======================
Core API Documentation
======================
This is the beginning of a manual for core kernel APIs. The conversion
(and writing!) of documents for this manual is much appreciated!
Core utilities
==============
This section has general and "core core" documentation. The first is a
massive grab-bag of kerneldoc info left over from the docbook days; it
should really be broken up someday when somebody finds the energy to do
it.
.. toctree::
:maxdepth: 1
kernel-api
workqueue
watch_queue
printk-basics
printk-formats
printk-index
symbol-namespaces
asm-annotations
Data structures and low-level utilities
=======================================
Library functionality that is used throughout the kernel.
.. toctree::
:maxdepth: 1
kobject
kref
cleanup
assoc_array
folio_queue
xarray
maple_tree
idr
circular-buffers
rbtree
generic-radix-tree
packing
this_cpu_ops
timekeeping
errseq
wrappers/atomic_t
wrappers/atomic_bitops
floating-point
union_find
min_heap
Low level entry and exit
========================
.. toctree::
:maxdepth: 1
entry
Concurrency primitives
======================
How Linux keeps everything from happening at the same time. See
Documentation/locking/index.rst for more related documentation.
.. toctree::
:maxdepth: 1
refcount-vs-atomic
irq/index
local_ops
padata
../RCU/index
wrappers/memory-barriers.rst
Low-level hardware management
=============================
Cache management, managing CPU hotplug, etc.
.. toctree::
:maxdepth: 1
cachetlb
cpu_hotplug
memory-hotplug
genericirq
protection-keys
Memory management
=================
How to allocate and use memory in the kernel. Note that there is a lot
more memory-management documentation in Documentation/mm/index.rst.
.. toctree::
:maxdepth: 1
memory-allocation
unaligned-memory-access
dma-api
dma-api-howto
dma-attributes
dma-isa-lpc
swiotlb
mm-api
cgroup
genalloc
pin_user_pages
boot-time-mm
gfp_mask-from-fs-io
Interfaces for kernel debugging
===============================
.. toctree::
:maxdepth: 1
debug-objects
tracepoint
debugging-via-ohci1394
Everything else
===============
Documents that don't fit elsewhere or which have yet to be categorized.
.. toctree::
:maxdepth: 1
librs
netlink
.. only:: subproject and html
Indices
=======
* :ref:`genindex`