From: Andrey Panin <pazke@orbita1.ru>
To: linux-kernel@vger.kernel.org
Cc: Linus Torvalds <torvalds@transmeta.com>
Subject: [PATCH] kernel/rcupdate.c microcleanup
Date: Tue, 11 Mar 2003 17:02:49 +0300 [thread overview]
Message-ID: <20030311140249.GB756@pazke> (raw)
[-- Attachment #1: Type: text/plain, Size: 469 bytes --]
Hi all,
attached patch (2.5.64) contains small cleanup of RCU code:
- move smp_processor_id() outside of irq disabled region in call_rcu();
- consolidate multiple spin_unlock() in the rcu_check_quiescent_state(),
remove some unneeded {} and make this function inline.
Tested and works (at least doesn't crash). Please consider applying.
Best regards.
--
Andrey Panin | Embedded systems software developer
pazke@orbita1.ru | PGP key: wwwkeys.pgp.net
[-- Attachment #2: patch-rcu --]
[-- Type: text/plain, Size: 1788 bytes --]
diff -urN -X /usr/share/dontdiff linux-2.5.64.vanilla/kernel/rcupdate.c linux-2.5.64/kernel/rcupdate.c
--- linux-2.5.64.vanilla/kernel/rcupdate.c Thu Nov 28 01:35:46 2002
+++ linux-2.5.64/kernel/rcupdate.c Mon Mar 10 20:18:48 2003
@@ -67,13 +67,12 @@
*/
void call_rcu(struct rcu_head *head, void (*func)(void *arg), void *arg)
{
- int cpu;
+ int cpu = smp_processor_id();
unsigned long flags;
head->func = func;
head->arg = arg;
local_irq_save(flags);
- cpu = smp_processor_id();
list_add_tail(&head->list, &RCU_nxtlist(cpu));
local_irq_restore(flags);
}
@@ -117,13 +116,12 @@
* switch). If so and if it already hasn't done so in this RCU
* quiescent cycle, then indicate that it has done so.
*/
-static void rcu_check_quiescent_state(void)
+static inline void rcu_check_quiescent_state(void)
{
int cpu = smp_processor_id();
- if (!test_bit(cpu, &rcu_ctrlblk.rcu_cpu_mask)) {
+ if (!test_bit(cpu, &rcu_ctrlblk.rcu_cpu_mask))
return;
- }
/*
* Races with local timer interrupt - in the worst case
@@ -134,23 +132,22 @@
RCU_last_qsctr(cpu) = RCU_qsctr(cpu);
return;
}
- if (RCU_qsctr(cpu) == RCU_last_qsctr(cpu)) {
+ if (RCU_qsctr(cpu) == RCU_last_qsctr(cpu))
return;
- }
spin_lock(&rcu_ctrlblk.mutex);
- if (!test_bit(cpu, &rcu_ctrlblk.rcu_cpu_mask)) {
- spin_unlock(&rcu_ctrlblk.mutex);
- return;
- }
+ if (!test_bit(cpu, &rcu_ctrlblk.rcu_cpu_mask))
+ goto out_unlock;
+
clear_bit(cpu, &rcu_ctrlblk.rcu_cpu_mask);
RCU_last_qsctr(cpu) = RCU_QSCTR_INVALID;
- if (rcu_ctrlblk.rcu_cpu_mask != 0) {
- spin_unlock(&rcu_ctrlblk.mutex);
- return;
- }
+ if (rcu_ctrlblk.rcu_cpu_mask != 0)
+ goto out_unlock;
+
rcu_ctrlblk.curbatch++;
rcu_start_batch(rcu_ctrlblk.maxbatch);
+
+out_unlock:
spin_unlock(&rcu_ctrlblk.mutex);
}
next reply other threads:[~2003-03-11 14:42 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-03-11 14:02 Andrey Panin [this message]
2003-03-11 15:23 ` Brian Gerst
2003-03-11 16:44 ` Linus Torvalds
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=20030311140249.GB756@pazke \
--to=pazke@orbita1.ru \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@transmeta.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®