← All procedures

algebra.oomVictim

This function gives the index of the task that the OOM killer of a cgroup takes: the task with the most points. Of tasks with equal points, the last one in the order of the scan wins (`mm/oom_kill.c`, lines 342-351). A task replaces the choice unless its points are less. It gives undefined when the OOM killer can take no task.

CLI
Package
@procedures/algebra · README
Path
["algebra","oomVictim"]
CLI
mark algebra oomVictim --tasks <object[]> --totalPages <number>
As data
{"$proc":["algebra","oomVictim"],"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","oomVictim"], { tasks: [], totalPages: 1 });
console.log(JSON.stringify(result));

From the command line

$ mark algebra oomVictim --tasks <object[]> --totalPages <number>

As data, in a program

{
  "$proc": ["algebra", "oomVictim"],
  "input": { "tasks": [], "totalPages": 1 }
}

Input

FieldTypeRequiredDefaultDescription
tasksobject[]yes
totalPagesnumberyes
pageSizenumberno

Output

The schema does not list fields (number | null).

JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "tasks": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "rss": {
              "type": "number",
              "description": "This count is the resident pages of the task: its anonymous, file and shared memory pages."
            },
            "swap": {
              "type": "number",
              "description": "This count is the swap entries of the task."
            },
            "pageTables": {
              "type": "number",
              "description": "This count is the bytes of the page tables of the task."
            },
            "adj": {
              "type": "number",
              "description": "This value is the `oom_score_adj` of the task, from −1000 to 1000."
            }
          },
          "required": [
            "rss",
            "swap",
            "pageTables",
            "adj"
          ],
          "additionalProperties": {}
        }
      },
      "totalPages": {
        "type": "number"
      },
      "pageSize": {
        "type": "number"
      }
    },
    "required": [
      "tasks",
      "totalPages"
    ],
    "additionalProperties": false
  },
  "output": {
    "type": [
      "number",
      "null"
    ]
  }
}