From: Henrik Nordstrom <hno@marasystems.com>
To: linux-kernel@vger.kernel.org
Subject: [patch] slab.c ATOMIC debug check to immediately trap atomic abuse while debugging
Date: 26 May 2003 21:57:19 +0200 [thread overview]
Message-ID: <1053979039.2163.52.camel@henrik.marasystems.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 699 bytes --]
Hi.
The attached patch extends slab debugging with an early check if ATOMIC
is required. The patch is relative to 2.4.20 but may also be interesting
for 2.5.
Normally the atomic requirement is only verified when the slab cache
needs to grow, but with this patch such errors is detected immediately
on first call if slab debugging is enabled.
This patch would have saved me from panic bug hunting after a system was
sent into production as the errors then would have been trapped
immediately during development. Probably many others would be helped by
this slab debugging to trap stupid memory allocation / locking errors
early on in development.
Regards
Henrik Nordström
MARA Systems AB, Sweden
[-- Attachment #2: slab_atomic_debug.patch --]
[-- Type: text/plain, Size: 436 bytes --]
--- linux-2.4.20-uml/mm/slab.c 2003-02-27 20:56:12.000000000 +0100
+++ linux-2.4.20-uml-henrik/mm/slab.c 2003-05-26 20:57:44.000000000 +0200
@@ -1338,6 +1338,12 @@
unsigned long save_flags;
void* objp;
+#if DEBUG
+ /* trap atomic bugs early on when debugging */
+ if (in_interrupt() && (flags & SLAB_LEVEL_MASK) != SLAB_ATOMIC)
+ BUG();
+#endif
+
kmem_cache_alloc_head(cachep, flags);
try_again:
local_irq_save(save_flags);
reply other threads:[~2003-05-26 19:44 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1053979039.2163.52.camel@henrik.marasystems.com \
--to=hno@marasystems.com \
--cc=linux-kernel@vger.kernel.org \
/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®