public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Richard Henderson <rth@twiddle.net>
To: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [patch 2.4.11-pre5] atomic_dec_and_lock() for alpha
Date: Thu, 11 Oct 2001 11:28:10 -0700	[thread overview]
Message-ID: <20011011112810.A1069@twiddle.net> (raw)
In-Reply-To: <20011008194257.A705@jurassic.park.msu.ru> <20011008102412.A24348@twiddle.net> <20011009143013.A2884@jurassic.park.msu.ru>
In-Reply-To: <20011009143013.A2884@jurassic.park.msu.ru>; from ink@jurassic.park.msu.ru on Tue, Oct 09, 2001 at 02:30:13PM +0400

On Tue, Oct 09, 2001 at 02:30:13PM +0400, Ivan Kokshaysky wrote:
> OK. I prefer the latter - rewriting in assembly won't allow DEBUG_SPINLOCK
> stuff in this function. OTOH, moving the return outside an asm statement
> adds only one instruction - conditional branch that falls through in the
> fast path.

Hmm.  What about a mixture:


  asm (".text					\n\
	.global atomic_dec_and_lock		\n\
	.ent atomic_dec_and_lock		\n\
atomic_dec_and_lock:				\n\
	.prologue 0				\n\
1:	ldl_l	$1, 0($16)			\n\
	subl	$1, 1, $1			\n\
	beq	2f				\n\
	stl_c	$1, 0($16)			\n\
	beq	$1, 3f				\n\
	mb					\n\
	ret					\n\
	.align	4				\n\
3:	br	1b				\n\
2:	lda	$27, atomic_dec_and_lock_1");

	/* FALLTHRU */
	
static int
atomic_dec_and_lock_1(atomic_t *atomic, spinlock_t *lock)
{
	/* Slow path */
	spin_lock(lock);
	if (atomic_dec_and_test(atomic))
		return 1;
	spin_unlock(lock);
	return 0;
}


r~

  reply	other threads:[~2001-10-11 18:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-10-08 15:42 [patch 2.4.11-pre5] atomic_dec_and_lock() for alpha Ivan Kokshaysky
2001-10-08 17:24 ` Richard Henderson
2001-10-09 10:30   ` Ivan Kokshaysky
2001-10-11 18:28     ` Richard Henderson [this message]
2001-10-12 12:35       ` Ivan Kokshaysky

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=20011011112810.A1069@twiddle.net \
    --to=rth@twiddle.net \
    --cc=ink@jurassic.park.msu.ru \
    --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