← All procedures

algebra.memcgThrottle

This function gives the throttle of a task that grows by `charges` charges of `batch` pages each. It starts from the usage of each level in `levels`: the cgroup of the task, then each ancestor below the root. Each charge adds `batch` pages to each level, and the task pays its debt of `batch` pages before the next charge. A task that touches one page at a time charges a batch of 64 at each 64th page.

CLI
Package
@procedures/algebra · README
Path
["algebra","memcgThrottle"]
CLI
mark algebra memcgThrottle --levels <object[]> --charges <number> --hz <number>
As data
{"$proc":["algebra","memcgThrottle"],"input":{}}

Use it

In TypeScript

import { Client, LocalTransport, PROCEDURE_REGISTRY } from "@procedures/client";
import "@procedures/algebra/register"; // registers its procedures

const client = new Client(new LocalTransport({ registry: PROCEDURE_REGISTRY }));
const result = await client.exec(["algebra","memcgThrottle"], { levels: [], charges: 1, hz: 1 });
console.log(JSON.stringify(result));

From the command line

$ mark algebra memcgThrottle --levels <object[]> --charges <number> --hz <number>

As data, in a program

{
  "$proc": ["algebra", "memcgThrottle"],
  "input": { "levels": [], "charges": 1, "hz": 1 }
}

Input

FieldTypeRequiredDefaultDescription
levelsobject[]yes
chargesnumberyes
hznumberyes
batchnumberno

Output

FieldTypeRequiredDefaultDescription
overnumberyesThese are the charges that left the cgroup above its high: each one sends the task to reclaim.
sleepsnumberyesThese are the charges whose debt put the task to sleep.
jiffiesnumberyesThis is the sum of the sleeps, in jiffies.
latenumberyesThis is how late the timer wheel can end those sleeps, in jiffies: one granularity of the level of each.
highnumberyesThese are the events `high` of the cgroup of the task: one at each reclaim of a charge, 17 at a charge that sleeps.
JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "levels": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "usage": {
              "type": "number"
            },
            "high": {
              "type": "number"
            }
          },
          "required": [
            "usage",
            "high"
          ],
          "additionalProperties": {}
        }
      },
      "charges": {
        "type": "number"
      },
      "hz": {
        "type": "number"
      },
      "batch": {
        "type": "number"
      }
    },
    "required": [
      "levels",
      "charges",
      "hz"
    ],
    "additionalProperties": false
  },
  "output": {
    "type": "object",
    "properties": {
      "over": {
        "type": "number",
        "description": "These are the charges that left the cgroup above its high: each one sends the task to reclaim."
      },
      "sleeps": {
        "type": "number",
        "description": "These are the charges whose debt put the task to sleep."
      },
      "jiffies": {
        "type": "number",
        "description": "This is the sum of the sleeps, in jiffies."
      },
      "late": {
        "type": "number",
        "description": "This is how late the timer wheel can end those sleeps, in jiffies: one granularity of the level of each."
      },
      "high": {
        "type": "number",
        "description": "These are the events `high` of the cgroup of the task: one at each reclaim of a charge, 17 at a charge that sleeps."
      }
    },
    "required": [
      "over",
      "sleeps",
      "jiffies",
      "late",
      "high"
    ],
    "additionalProperties": {}
  }
}