GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • The Linux Kernel
  • Development process
  • Submitting patches
  • Code of conduct
  • Maintainer handbook
  • All development-process docs
  • Core API
  • Memory Allocation Guide
  • Unaligned Memory Accesses
  • Dynamic DMA mapping using the generic device
  • Dynamic DMA mapping Guide
  • DMA attributes
  • DMA with ISA and LPC devices
  • DMA and swiotlb

This view

  • Original page
  • New address

GeezerVison is showing docs.kernel.org — Cgroup Kernel APIs — The Linux Kernel documentation

Cgroup Kernel APIs¶

Device Memory Cgroup API (dmemcg)¶

bool dmem_cgroup_state_evict_valuable(struct dmem_cgroup_pool_state *limit_pool, struct dmem_cgroup_pool_state *test_pool, bool ignore_low, bool *ret_hit_low)¶

Check if we should evict from test_pool

Parameters

struct dmem_cgroup_pool_state *limit_pool

The pool for which we hit limits

struct dmem_cgroup_pool_state *test_pool

The pool for which to test

bool ignore_low

Whether we have to respect low watermarks.

bool *ret_hit_low

Pointer to whether it makes sense to consider low watermark.

Description

This function returns true if we can evict from test_pool, false if not. When returning false and ignore_low is false, ret_hit_low may be set to true to indicate this function can be retried with ignore_low set to true.

Return

bool

void dmem_cgroup_unregister_region(struct dmem_cgroup_region *region)¶

Unregister a previously registered region.

Parameters

struct dmem_cgroup_region *region

The region to unregister.

Description

This function undoes dmem_cgroup_register_region. It drains any in-flight reclaim callbacks before returning, so the caller may safely free the resources pointed to by the reclaim_priv that was passed at registration time.

struct dmem_cgroup_region *dmem_cgroup_register_region(const struct dmem_cgroup_init *init, const char *fmt, ...)¶

Register a regions for dev cgroup.

Parameters

const struct dmem_cgroup_init *init

Initialization parameters for the region.

const char *fmt

Region parameters to register

...

variable arguments

Description

This function registers a node in the dmem cgroup with the name given. After calling this function, the region can be used for allocations.

Return

NULL or a struct on success, PTR_ERR on failure.

void dmem_cgroup_pool_state_put(struct dmem_cgroup_pool_state *pool)¶

Drop a reference to a dmem_cgroup_pool_state

Parameters

struct dmem_cgroup_pool_state *pool

dmem_cgroup_pool_state

Description

Called to drop a reference to the limiting pool returned by dmem_cgroup_try_charge().

void dmem_cgroup_uncharge(struct dmem_cgroup_pool_state *pool, u64 size)¶

Uncharge a pool.

Parameters

struct dmem_cgroup_pool_state *pool

Pool to uncharge.

u64 size

Size to uncharge.

Description

Undoes the effects of dmem_cgroup_try_charge. Must be called with the returned pool as argument, and same index and size.

int dmem_cgroup_try_charge(struct dmem_cgroup_region *region, u64 size, struct dmem_cgroup_pool_state **ret_pool, struct dmem_cgroup_pool_state **ret_limit_pool)¶

Try charging a new allocation to a region.

Parameters

struct dmem_cgroup_region *region

dmem region to charge

u64 size

Size (in bytes) to charge.

struct dmem_cgroup_pool_state **ret_pool

On successful allocation, the pool that is charged.

struct dmem_cgroup_pool_state **ret_limit_pool

On a failed allocation, the limiting pool.

Description

This function charges the region region for a size of size bytes.

If the function succeeds, ret_pool is set, which must be passed to dmem_cgroup_uncharge() when undoing the allocation.

When this function fails with -EAGAIN and ret_limit_pool is non-null, it will be set to the pool for which the limit is hit. This can be used for eviction as argument to dmem_cgroup_state_evict_valuable(). This reference must be freed with dmem_cgroup_pool_state_put().

Return

0 on success, -EAGAIN on hitting a limit, or a negative errno on failure.

bool dmem_cgroup_below_min(struct dmem_cgroup_pool_state *root, struct dmem_cgroup_pool_state *test)¶

Tests whether current usage is within min limit.

Parameters

struct dmem_cgroup_pool_state *root

Root of the subtree to calculate protection for, or NULL to calculate global protection.

struct dmem_cgroup_pool_state *test

The pool to test the usage/min limit of.

Return

true if usage is below min and the cgroup is protected, false otherwise.

bool dmem_cgroup_below_low(struct dmem_cgroup_pool_state *root, struct dmem_cgroup_pool_state *test)¶

Tests whether current usage is within low limit.

Parameters

struct dmem_cgroup_pool_state *root

Root of the subtree to calculate protection for, or NULL to calculate global protection.

struct dmem_cgroup_pool_state *test

The pool to test the usage/low limit of.

Return

true if usage is below low and the cgroup is protected, false otherwise.

struct dmem_cgroup_pool_state *dmem_cgroup_get_common_ancestor(struct dmem_cgroup_pool_state *a, struct dmem_cgroup_pool_state *b)¶

Find the first common ancestor of two pools.

Parameters

struct dmem_cgroup_pool_state *a

First pool to find the common ancestor of.

struct dmem_cgroup_pool_state *b

First pool to find the common ancestor of.

Return

The first pool that is a parent of both a and b, or NULL if either a or b are NULL, or if such a pool does not exist. A reference to the returned pool is grabbed and must be released by the caller when it is done using the pool.

©The kernel development community. | Powered by Sphinx 5.3.0 & Alabaster 0.7.16 | Page source
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.