← All procedures

algebra.oomBadness

This function gives the points of a task for the OOM killer. The points are its resident pages, its swap entries and the pages of its page tables. To this sum, the kernel adds `oom_score_adj` times `totalPages / 1000`, in integer arithmetic. A task at −1000 gives undefined, because the OOM killer does not take it.

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

From the command line

$ mark algebra oomBadness --task <object> --totalPages <number>

As data, in a program

{
  "$proc": ["algebra", "oomBadness"],
  "input": { "task": {}, "totalPages": 1 }
}

Input

FieldTypeRequiredDefaultDescription
taskobjectyes
totalPagesnumberyes
pageSizenumberno

Output

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

JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "task": {
        "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": [
      "task",
      "totalPages"
    ],
    "additionalProperties": false
  },
  "output": {
    "type": [
      "number",
      "null"
    ]
  }
}