Skip to main content

Module inotify

Module inotify 

Source
Expand description

A single inotify instance which watches the memory events files of all containers.

Structsยง

SharedWatcher ๐Ÿ”’
A single inotify instance shared by all OOM watchers.
Subscription ๐Ÿ”’
A subscription to the SharedWatcher which unsubscribes on drop.
Watch ๐Ÿ”’
A watch of a file and its subscribers.
WatchEvent ๐Ÿ”’
A watch event as delivered to subscribers.
Watches ๐Ÿ”’
The watches by descriptor. A watch belongs to a file rather than to its path: a file which got recreated gets a watch of its own, and the events of the old one, like its removal, must not reach the subscribers of the new one.

Constantsยง

MIN_DISPATCH_INTERVAL ๐Ÿ”’
How often the events get dispatched at most. The kernel notifies a change of the memory events of a cgroup up to every 10 ms, and one of the hierarchical ones of every ancestor, which alternate in the queue, so that inotify does not merge them. Under memory pressure, like at memory.high or memory.max, a single container would wake the server up to a hundred times a second otherwise, and every one of its watchers would read its counters as often. The queue of the kernel holds 16384 events by default, which takes more than 1600 watched files changing in one interval, far more than the containers of a pod. An overflow gets dispatched to every watcher, see Watches::dispatch.
WATCH_FLAGS ๐Ÿ”’
What a watch reports. cgroupfs notifies a change of the memory events with IN_MODIFY and the removal of a cgroup with IN_IGNORED only, which every watch gets anyway.

Staticsยง

SHARED_WATCHER ๐Ÿ”’
The shared watcher is kept alive by its subscriptions. It gets created on the first subscription and dropped with the last one, which frees the inotify instance while no container is watched. A failed creation is retried on the next subscription instead of being cached, and so is a watcher whose reader stopped. The server has a single runtime, which reads the events.

Type Aliasesยง

Slot ๐Ÿ”’
Where the shared watcher is kept, see SharedWatcher::get.