Re: [PATCH] mm, compaction: Indicate when compaction is manually triggered by sysctl

From: Andrew Morton
Date: Thu May 07 2020 - 19:04:41 EST


On Thu, 7 May 2020 18:59:46 -0300 "Guilherme G. Piccoli" <gpiccoli@xxxxxxxxxxxxx> wrote:

> Currently we have no way to determine if compaction was triggered
> by sysctl write, but this is an interesting information to have,
> specially in systems with high uptime that presents lots of
> fragmented memory. There's no statistic indicating if compaction
> was triggered manually or ran by Linux itself, the vmstat numbers
> cannot tell the user this information.

Could add it to vmstat?

> This patch adds a very simple message to kernel log when compaction
> is requested through a write to sysctl file, and also it accumulates
> the number of previously manual compaction executions. It follows
> the approach used by drop_caches.

Userspace could write to /dev/kmsg when it decides to trigger
compaction? Although using the kernel log seems a fairly lame way for
userspace to record its own actions...