mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ingo Oeser <ingo.oeser@informatik.tu-chemnitz.de>
To: Jacob Luna Lundberg <jacob@velius.chaos2.org>
Cc: linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH (2.4)] atomic use count for proc_dir_entry
Date: Fri, 17 Nov 2000 12:24:33 +0100	[thread overview]
Message-ID: <20001117122433.I703@nightmaster.csn.tu-chemnitz.de> (raw)
In-Reply-To: <Pine.LNX.4.21.0011170905030.19287-100000@callisto.yi.org> <Pine.LNX.4.21.0011170026130.10109-100000@velius.chaos2.org>
In-Reply-To: <Pine.LNX.4.21.0011170026130.10109-100000@velius.chaos2.org>; from jacob@velius.chaos2.org on Fri, Nov 17, 2000 at 12:35:03AM -0800

On Fri, Nov 17, 2000 at 12:35:03AM -0800, Jacob Luna Lundberg wrote:
> > atomic_dec_and_test() returns true.
> 
> Indeed, after studying the asm in question I think I see how it ticks.
> What is the reasoning behind reversing the result of the test instead of
> returning the new value of the counter?

The full name of this operation is: "Decrement the value given
and test the result for equality with zero in one atomic operation".

So basically: 

#define dec_and_test(i) ( (--i) ? 0 : 1)

but atomically.

This is implemented in hardware for some archs and a required
operation for proper and fast refcounting.

Regards

Ingo Oeser
-- 
To the systems programmer, users and applications
serve only to provide a test load.
<esc>:x
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

  parent reply	other threads:[~2000-11-17 10:55 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-11-17  5:21 Jacob Luna Lundberg
2000-11-17  7:26 ` Dan Aloni
2000-11-17  8:35   ` Jacob Luna Lundberg
2000-11-17  9:51     ` Dan Aloni
2000-11-17 11:24     ` Ingo Oeser [this message]
  -- strict thread matches above, loose matches on Subject: below --
2000-11-16 21:00 Dan Aloni
2000-11-16 21:14 ` Linus Torvalds
2000-11-16 21:31   ` Dan Aloni
2000-11-17  8:37     ` Dan Aloni
2000-11-17 11:23       ` Francois romieu
2000-11-17 11:40         ` Dan Aloni

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=20001117122433.I703@nightmaster.csn.tu-chemnitz.de \
    --to=ingo.oeser@informatik.tu-chemnitz.de \
    --cc=jacob@velius.chaos2.org \
    --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®