[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <adahbnp6rmr.fsf@roland-alpha.cisco.com>
Date: Mon, 05 Apr 2010 23:07:24 -0700
From: Roland Dreier <rdreier@...co.com>
To: 杨硕 <shanqn@...il.com>
Cc: linux-kernel@...r.kernel.org
Subject: Re: in x86 architecture ,why the function atomic_sub_and_test() does not disable the interrupt?
> static inline int atomic_sub_and_test(int i, atomic_t *v)
> {
> unsigned char c;
>
> asm volatile(LOCK_PREFIX "subl %2,%0; sete %1"
> : "+m" (v->counter), "=qm" (c)
> : "ir" (i) : "memory");
> return c;
> }
Why would disabling interrupts be necessary? The LOCK_PREFIX makes the
subl atomic, and the sete just operates using the flag set by subl, so
it doesn't matter if any interrupts occur or not (since returning from
an interrupt must obviously restore flags).
--
Roland Dreier <rolandd@...co.com> || For corporate legal information go to:
http://www.cisco.com/web/about/doing_business/legal/cri/index.html
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists