From: Sergio Aguirre <saaguirre@ti.com>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Sergio Aguirre <saaguirre@ti.com>,
Huang Ying <ying.huang@intel.com>,
Martin Schwidefsky <schwidefsky@de.ibm.com>,
Ingo Molnar <mingo@elte.hu>, Kyle McMartin <kyle@mcmartin.ca>,
Peter Zijlstra <a.p.zijlstra@chello.nl>
Subject: [RFC][PATCH] irq_work: Don't ignore possible cmpxchg failure
Date: Tue, 16 Nov 2010 10:32:59 -0600 [thread overview]
Message-ID: <1289925179-17085-1-git-send-email-saaguirre@ti.com> (raw)
Although is very unlikely, it's better to make sure we're not
letting this happen.
This solves this compilation warning:
kernel/irq_work.c: In function 'irq_work_run':
kernel/irq_work.c:148: warning: value computed is not used
Signed-off-by: Sergio Aguirre <saaguirre@ti.com>
Cc: Huang Ying <ying.huang@intel.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Kyle McMartin <kyle@mcmartin.ca>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
---
kernel/irq_work.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/kernel/irq_work.c b/kernel/irq_work.c
index f16763f..5da635b 100644
--- a/kernel/irq_work.c
+++ b/kernel/irq_work.c
@@ -131,7 +131,7 @@ void irq_work_run(void)
list = xchg(head, NULL);
while (list != NULL) {
- struct irq_work *entry = list;
+ struct irq_work *entry = list, *xchgres;
list = irq_work_next(list);
@@ -145,7 +145,10 @@ void irq_work_run(void)
* Clear the BUSY bit and return to the free state if
* no-one else claimed it meanwhile.
*/
- cmpxchg(&entry->next, next_flags(NULL, IRQ_WORK_BUSY), NULL);
+ xchgres = cmpxchg(&entry->next,
+ next_flags(NULL, IRQ_WORK_BUSY),
+ NULL);
+ BUG_ON(unlikely(xchgres != next_flags(NULL, IRQ_WORK_BUSY)));
}
}
EXPORT_SYMBOL_GPL(irq_work_run);
--
1.7.0.4
next reply other threads:[~2010-11-16 16:33 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-16 16:32 Sergio Aguirre [this message]
2010-11-16 16:45 ` [RFC][PATCH] irq_work: Don't ignore possible cmpxchg failure Peter Zijlstra
2010-11-16 16:57 ` Aguirre, Sergio
2010-11-16 17:08 ` Peter Zijlstra
2010-11-16 17:11 ` Aguirre, Sergio
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=1289925179-17085-1-git-send-email-saaguirre@ti.com \
--to=saaguirre@ti.com \
--cc=a.p.zijlstra@chello.nl \
--cc=kyle@mcmartin.ca \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=schwidefsky@de.ibm.com \
--cc=ying.huang@intel.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).