linux-rt-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Arnd Bergmann <arnd@arndb.de>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	linux-rt-users@vger.kernel.org, will.deacon@arm.com,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] locking/rtmutex: drop usage of __HAVE_ARCH_CMPXCHG
Date: Wed, 25 Feb 2015 18:58:16 +0100	[thread overview]
Message-ID: <20150225175816.GF6823@linutronix.de> (raw)
In-Reply-To: <20150225175613.GE6823@linutronix.de>

* Sebastian Andrzej Siewior | 2015-02-25 18:56:13 [+0100]:

>To put some numbers on it: preempt -RT, am335x, 10 loops of
>100000 invocations of rt_spin_lock() + rt_spin_unlock() (time "total" is
>the average of the 10 loops for the 100000 invocations, "loop" is
>"total / 100000 * 1000"):

This is the test code I was running.

diff --git a/init/main.c b/init/main.c
index e7cb76c079d4..e74523feeddb 100644
--- a/init/main.c
+++ b/init/main.c
@@ -1004,6 +1004,29 @@ static noinline void __init kernel_init_freeable(void)
 
 	do_basic_setup();
 
+	{
+		spinlock_t main_l;
+		int loops;
+
+		spin_lock_init(&main_l);
+
+		for (loops = 0; loops < 10; loops++) {
+			ktime_t start, end;
+			int i;
+
+			local_irq_disable();
+			start = ktime_get();
+			for (i = 0; i <= 100000; i++) {
+				rt_spin_lock(&main_l);
+				rt_spin_unlock(&main_l);
+			}
+			end = ktime_get();
+			local_irq_enable();
+			pr_err("%s(%d) %lld\n", __func__, __LINE__,
+			       ktime_to_us(ktime_sub(end, start)));
+		}
+	}
+
 	/* Open the /dev/console on the rootfs, this should never fail */
 	if (sys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0)
 		pr_err("Warning: unable to open an initial console.\n");

      reply	other threads:[~2015-02-25 17:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-25 17:56 [PATCH] locking/rtmutex: drop usage of __HAVE_ARCH_CMPXCHG Sebastian Andrzej Siewior
2015-02-25 17:58 ` Sebastian Andrzej Siewior [this message]

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=20150225175816.GF6823@linutronix.de \
    --to=bigeasy@linutronix.de \
    --cc=arnd@arndb.de \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=will.deacon@arm.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;
as well as URLs for NNTP newsgroup(s).