linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Waiman Long <longman@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Alexey Dobriyan <adobriyan@gmail.com>,
	Kees Cook <keescook@chromium.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	Davidlohr Bueso <dave@stgolabs.net>,
	Miklos Szeredi <miklos@szeredi.hu>,
	Daniel Colascione <dancol@google.com>,
	Dave Chinner <david@fromorbit.com>,
	Randy Dunlap <rdunlap@infradead.org>
Subject: Re: [PATCH v2 0/4] /proc/stat: Reduce irqs counting performance overhead
Date: Wed, 9 Jan 2019 11:59:44 -0800	[thread overview]
Message-ID: <20190109195944.GQ6310@bombadil.infradead.org> (raw)
Message-ID: <20190109195944.apqZzSUBIHCu3V5gXWiDy87PZq_SAeScJjI4l3JnPWk@z> (raw)
In-Reply-To: <3f44cc18-4dd8-e313-26b9-1502b0b40507@redhat.com>

On Wed, Jan 09, 2019 at 01:54:36PM -0500, Waiman Long wrote:
> If you read patch 4, you can see that quite a bit of CPU cycles was
> spent looking up the radix tree to locate the IRQ descriptor for each of
> the interrupts. Those overhead will still be there even if I use percpu
> counters. So using percpu counter alone won't be as performant as this
> patch or my previous v1 patch.

Hm, if that's the overhead, then the radix tree (and the XArray) have
APIs that can reduce that overhead.  Right now, there's only one caller
of kstat_irqs_usr() (the proc code).  If we change that to fill an array
instead of returning a single value, it can look something like this:

void kstat_irqs_usr(unsigned int *sums)
{
	XA_STATE(xas, &irq_descs, 0);
	struct irq_desc *desc;

	xas_for_each(&xas, desc, ULONG_MAX) {
		unsigned int sum = 0;

		if (!desc->kstat_irqs)
			continue;
		for_each_possible_cpu(cpu)
			sum += *per_cpu_ptr(desc->kstat_irqs, cpu);

		sums[xas->xa_index] = sum;
	}
}

  reply	other threads:[~2019-01-09 19:59 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-09 17:23 [PATCH v2 0/4] /proc/stat: Reduce irqs counting performance overhead Waiman Long
2019-01-09 17:23 ` [PATCH v2 1/4] /proc/stat: Extract irqs counting code into show_stat_irqs() Waiman Long
2019-01-09 17:23 ` [PATCH v2 2/4] /proc/stat: Only do percpu sum of active IRQs Waiman Long
2019-01-09 17:23 ` [PATCH v2 3/4] genirq: Track the number " Waiman Long
2019-01-09 17:23 ` [PATCH v2 4/4] /proc/stat: Call kstat_irqs_usr() only for " Waiman Long
2019-01-09 17:23   ` Waiman Long
2019-01-09 17:39   ` Waiman Long
2019-01-09 17:44 ` [PATCH v2 0/4] /proc/stat: Reduce irqs counting performance overhead Matthew Wilcox
2019-01-09 18:03   ` Waiman Long
2019-01-09 18:24     ` Matthew Wilcox
2019-01-09 18:37       ` Waiman Long
2019-01-09 18:52         ` Matthew Wilcox
2019-01-09 18:57           ` Waiman Long
2019-01-09 18:54         ` Waiman Long
2019-01-09 19:59           ` Matthew Wilcox [this message]
2019-01-09 19:59             ` Matthew Wilcox
2019-01-09 20:14             ` Waiman Long
2019-01-09 20:14               ` Waiman Long

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=20190109195944.GQ6310@bombadil.infradead.org \
    --to=willy@infradead.org \
    --cc=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=dancol@google.com \
    --cc=dave@stgolabs.net \
    --cc=david@fromorbit.com \
    --cc=keescook@chromium.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=longman@redhat.com \
    --cc=miklos@szeredi.hu \
    --cc=rdunlap@infradead.org \
    --cc=tglx@linutronix.de \
    /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;
as well as URLs for NNTP newsgroup(s).