mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Nikita V. Youshchenko" <yoush@cs.msu.su>
To: linux-kernel@vger.kernel.org
Subject: Strange in_atomic() definition in include/linux/hardirq.h
Date: Sat, 20 Nov 2004 22:32:11 +0300	[thread overview]
Message-ID: <200411202232.33431@sercond.localdomain> (raw)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello.

In linux 2.6.9, in include/linux/hardirq.h, if CONFIG_PREEMPT is set, 
isw_atomic() is defines as

#define in_atomic() 
 ((preempt_count() & ~PREEMPT_ACTIVE) != kernel_locked())

preempt_count (after PREEMPT_ACTIVE is cleared out) looks to be an integer 
counter, increased in preempt_disable() and increased in preempt_enable().

kernel_locked() is defined in include/linux/smp_lock.h as
#define kernel_locked()  (current->lock_depth >= 0)

So in in_atomic() definition, integer counter is compared with boolean 
value. Looks like a bug.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFBn5vOv3x5OskTLdsRAkr1AJ9lqX/U58rahDFAP7v9dIf30ZzPSACfcU4u
4JzBcBAuqdrghmgeRnWfBds=
=E9Hd
-----END PGP SIGNATURE-----

                 reply	other threads:[~2004-11-20 19:32 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=200411202232.33431@sercond.localdomain \
    --to=yoush@cs.msu.su \
    --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®