lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 26 Feb 2020 17:19:41 +0100
From:   Peter Zijlstra <peterz@...radead.org>
To:     Luigi Rizzo <lrizzo@...gle.com>
Cc:     linux-kernel@...r.kernel.org, mhiramat@...nel.org,
        akpm@...ux-foundation.org, gregkh@...uxfoundation.org,
        naveen.n.rao@...ux.ibm.com, ardb@...nel.org, rizzo@....unipi.it,
        pabeni@...hat.com, giuseppe.lettieri@...pi.it, toke@...hat.com,
        hawk@...nel.org, mingo@...hat.com, acme@...nel.org,
        rostedt@...dmis.org
Subject: Re: [PATCH v2 1/2] kstats: kernel metric collector

On Wed, Feb 26, 2020 at 05:46:36AM -0800, Luigi Rizzo wrote:
> kstats is a helper to accumulate in-kernel metrics (timestamps, sizes,
> etc.) and show distributions through debugfs.
> Set CONFIG_KSTATS=m or y to enable it.
> 
> Creating a metric takes one line of code (and one to destroy it):
> 
>   struct kstats *key = kstats_new("foo", 3 /* frac_bits */);
>   ...
>   kstats_delete(key);
> 
> The following line records a u64 sample:
> 
>   kstats_record(key, value);
> 
> kstats_record() is cheap (5ns hot cache, 250ns cold cache). Samples are
> accumulated in a per-cpu array with 2^frac_bits slots for each power
> of 2. Using frac_bits = 3 gives about 30 slots per decade.

So I think everybody + dog has written code like this, although I never
bothered with the log2 based buckets myself. Nor have I ever bothered
with doing a debugfs interface.

I find it very hard to convince myself something like this deserves to
live upstream, vs. remaining in the local debug/hack toolbox.

Tracing has an aggregator (histogram), you can dump the raw deltas, or
you can hack up a custom aggregator in a few lines, or you do BPF if
you're so inclined.

Why do we need this specific one?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ