linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: William Lee Irwin III <wli@holomorphy.com>
To: linux-mm@kvack.org
Subject: watching bloated slabs
Date: Mon, 29 Jul 2002 23:28:02 -0700	[thread overview]
Message-ID: <20020730062802.GB29537@holomorphy.com> (raw)

[-- Attachment #1: bloated message --]
[-- Type: text/plain, Size: 563 bytes --]

I got to wondering about how bloated various slabs were, and how
perhaps to track their bloatedness over time. So I brewed up a couple
of scripts to help more closely observe their humongous bloatedness.

bloatmon just cooks some slab stats so it grinds out lines with the
cache name, amount of space granted to callers, amount of space parked
in the slab, and percent utilization.

bloatmeter drives bloatmon in a loop, sorts its output by %util, and
chops off the output at 22 lines to put the most underutilized (and
hence bloated) slabs up top.

Cheers,
Bill

[-- Attachment #2: bloatmon --]
[-- Type: text/plain, Size: 413 bytes --]

#!/usr/bin/awk -f
BEGIN {
	printf "%18s    %8s %8s %8s\n", "cache", "active", "alloc", "%util";
}

{
	if ($3 != 0.0) {
		pct  = 100.0 * $2 / $3;
		frac = (10000.0 * $2 / $3) % 100;
	} else {
		pct  = 100.0;
		frac = 0.0;
	}
	active = ($2 * $4)/1024;
	alloc  = ($3 * $4)/1024;
	if ((alloc - active) < 1.0) {
		pct  = 100.0;
		frac = 0.0;
	}
	printf "%18s: %8dKB %8dKB  %3d.%-2d\n", $1, active, alloc, pct, frac;
}

[-- Attachment #3: bloatmeter --]
[-- Type: text/plain, Size: 133 bytes --]

#!/bin/sh
while : ; do
	grep -v '^slabinfo' /proc/slabinfo	\
		| bloatmon			\
		| sort -n -k 4,4		\
		| head -22
	sleep 5
	echo
done

                 reply	other threads:[~2002-07-30  6:28 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020730062802.GB29537@holomorphy.com \
    --to=wli@holomorphy.com \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox