mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paolo Abeni <pabeni@redhat.com>
To: Luigi Rizzo <lrizzo@google.com>,
	linux-kernel@vger.kernel.org, mhiramat@kernel.org,
	akpm@linux-foundation.org, gregkh@linuxfoundation.org,
	naveen.n.rao@linux.ibm.com, ardb@kernel.org, rizzo@iet.unipi.it,
	giuseppe.lettieri@unipi.it, toke@redhat.com, hawk@kernel.org,
	mingo@redhat.com, acme@kernel.org, rostedt@goodmis.org,
	peterz@infradead.org
Subject: Re: [PATCH v3 1/2] kstats: kernel metric collector
Date: Wed, 26 Feb 2020 15:48:49 +0100	[thread overview]
Message-ID: <6bda45c24afb5bbd069af6f57b07880cd2f5af52.camel@redhat.com> (raw)
In-Reply-To: <20200226135027.34538-2-lrizzo@google.com>

Hi,

I'm sorry for the lack of feedback on earlier iteration, I've simply
been too slow.

On Wed, 2020-02-26 at 05:50 -0800, Luigi Rizzo wrote:
[...]
> +static void ks_print(struct seq_file *p, int slot, int cpu, u64 sum,
> +		     u64 tot, unsigned long samples, unsigned long avg)
> +{
> +	unsigned long frac = (tot == 0) ? 0 : ((sum % tot) * 1000000) / tot;

I think/fear kbuildbot will still trigger some build issues on 32bit
arches on the above line.

I think div64_u64_rem() should be used in place of '%' for and 
div64_u64() in place of '/' when operating on 64bits integers. 

There are a few more occurences below.

[...]
> ++	/* preempt_disable makes sure samples and sum modify the same slot.
> +	 * this_cpu_add() uses a non-interruptible add to protect against
> +	 * hardware interrupts which may call kstats_record.
> +	 */
> +	preempt_disable();
> +	this_cpu_add(ks->slots[slot].samples, 1);

I think 'this_cpu_inc()' could be used here.

> +	this_cpu_add(ks->slots[slot].sum,
> +		     bucket < SUM_SCALE ? val : (val >> (bucket - SUM_SCALE)));
> +	preempt_enable();
> +}
> +EXPORT_SYMBOL(kstats_record);

Thanks for sharing, this infra will be likely quite useful to me :)

Cheers,

Paolo


  reply	other threads:[~2020-02-26 14:49 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-26 13:50 [PATCH v3 0/2] " Luigi Rizzo
2020-02-26 13:50 ` [PATCH v3 1/2] " Luigi Rizzo
2020-02-26 14:48   ` Paolo Abeni [this message]
2020-03-10 13:58   ` kbuild test robot
2020-03-10 16:44   ` kbuild test robot
2020-03-11  0:08   ` kbuild test robot
2020-03-11  3:30   ` kbuild test robot
2020-02-26 13:50 ` [PATCH v3 2/2] kstats: kretprobe and tracepoint support Luigi Rizzo
2020-02-26 15:00 ` [PATCH v3 0/2] kstats: kernel metric collector Toke Høiland-Jørgensen
2020-02-26 16:31   ` Alexei Starovoitov
2020-02-26 17:26   ` Luigi Rizzo
2020-02-26 19:14     ` Peter Zijlstra
2020-02-26 20:49     ` Alexei Starovoitov
2020-02-26 23:11     ` Toke Høiland-Jørgensen
2020-02-27 10:31       ` Luigi Rizzo
2020-02-27 12:13         ` Toke Høiland-Jørgensen

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=6bda45c24afb5bbd069af6f57b07880cd2f5af52.camel@redhat.com \
    --to=pabeni@redhat.com \
    --cc=acme@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=ardb@kernel.org \
    --cc=giuseppe.lettieri@unipi.it \
    --cc=gregkh@linuxfoundation.org \
    --cc=hawk@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lrizzo@google.com \
    --cc=mhiramat@kernel.org \
    --cc=mingo@redhat.com \
    --cc=naveen.n.rao@linux.ibm.com \
    --cc=peterz@infradead.org \
    --cc=rizzo@iet.unipi.it \
    --cc=rostedt@goodmis.org \
    --cc=toke@redhat.com \
    /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

all inboxes | Powered by JetHome®