From: "Kaigai Kohei" <kaigai@ak.jp.nec.com>
To: "Linux Kernel ML(Eng)" <linux-kernel@vger.kernel.org>
Subject: PATCH] atomic_inc_return() [0/5] (Re: atomic_inc_return)
Date: Fri, 10 Sep 2004 13:05:32 +0900 [thread overview]
Message-ID: <01be01c496eb$6a9dbd60$f97d220a@linux.bs1.fc.nec.co.jp> (raw)
In-Reply-To: <Pine.LNX.4.44.0409092005430.14004-100000@localhost.localdomain>
The first mail to LKML was returned to me because Triple-X was in subject.
I tried to send this one again.
---------------------------
Hello, Hugh Dickins
> KaiGai-San,
>
> I believe you have a patch adding those to i386 (including CONFIG_M386
> runtime check lest it's an actual i386 which cannot do "xadd") and x86_64.
> I'd be glad to see that go into the tree, would you be ready to submit it
> to Andrew or Linus based on the current 2.6 BK tree?
Indeed, I hope to do this.
atomic_inc_return() is necessary for the 'SELinux performance improvement
by RCU' patch.
See, http://lkml.org/lkml/2004/8/30/63
[PATCH]SELinux performance improvement by RCU (Re: RCU issue with SELinux)
These fundamental functions should be managed in up-stream.
> I think arm was missing the inc and dec, but has recently gained them.
> arm26 doesn't have any of the four, but it's not SMP, and just a matter
> of following the other examples in its atomic.h to add them. sparc64
> is missing the add and sub (which neither of us particularly need),
> I think just because nobody was using them: easily added - I think
> it'd be a good idea for all architectures to have the set of four.
I made patches for i386, x86_64, arm, arm26 and sparc64.
These patches apply to both linux-2.6.9-rc1 and 2.6.9-rc1-mm4.
[1/5] atomic_inc_return-linux-2.6.9-rc1.i386.patch
This patch implements atomic_inc_return() and so on for i386,
and includes runtime check whether CPU is legacy 386.
It is same as I posted to LKML and Andi Kleen at '04/09/01.
[2/5] atomic_inc_return-linux-2.6.9-rc1.x86_64.patch
This patch implements atomic_inc_return() and so on for x86_64.
It is same as I posted to LKML and Andi Kleen at '04/09/01.
[3/5] atomic_inc_return-linux-2.6.9-rc1.arm.patch
This patch declares atomic_inc_return() as the alias of atomic_add_return()
and atomic_dec_return() as an alias of atomic_dec_return().
This patch has not been tested, since we don't have ARM machine.
I want to let this reviewed by ARM specialists.
[4/5] atomic_inc_return-linux-2.6.9-rc1.arm26.patch
This patch implements atomic_inc_return() and so on for ARM26.
Because Hugh says that SMP is not supported in arm26, it is implemented
by normal operations between local_irq_save() and local_irq_restore()
like another atomic operations.
This patch has not been tested, since we don't have ARM26 machine.
I want to let this reviewed by ARM26 specialists.
[5/5] atomic_inc_return-linux-2.6.9-rc1.sparc64.patch
This patch declares atomic_add_return() as an alias of __atomic_add().
atomic64_add_return(),atomic_sub_return() and atomic64_sub_return() are same.
This patch has not been tested, since we don't have SPARC64 machine.
I want to let this reviewed by SPARC64 specialists.
--------
Kai Gai <kaigai@ak.jp.nec.com>
> Andrew,
>
> Sorry, I think I must ask you to back my lighten-mmlist_lock.patch
> out of -mm for the moment, and I'll resubmit a little later on.
>
> Reason being, though nobody is at all likely to hit the race,
> I've put a pathetic piece of self-delusion in try_to_unuse:
> if (!atomic_read(&mm->mm_users))
> continue;
> atomic_inc(&mm->mm_users);
>
> I've tried several ways of fixing it (including reworking that dance
> using marker mms instead of raised counts), but got bored or given up
> in disgust over most of them. Much the nicest fix would be:
> if (atomic_inc_return(&mm->mm_users) == 1) {
> atomic_dec(&mm->mm_users);
> continue;
> }
>
> (Since, if mm_users was 0, try_to_unuse is the only one which could
> be incrementing it; and though it's possible to do two swapoffs at
> once, we here have the mmlist_lock guarding against another.)
>
> But that suffers from the drawback that not all architectures currently
> support atomic_inc_return (nor do all support cmpxchg, which could have
> been used instead), and its friends atomic_add_return, atomic_sub_return,
> atomic_dec_return. Though most do: wouldn't it be nice if they all did?
>
> KaiGai-San,
>
> I believe you have a patch adding those to i386 (including CONFIG_M386
> runtime check lest it's an actual i386 which cannot do "xadd") and x86_64.
> I'd be glad to see that go into the tree, would you be ready to submit it
> to Andrew or Linus based on the current 2.6 BK tree?
>
> I think arm was missing the inc and dec, but has recently gained them.
> arm26 doesn't have any of the four, but it's not SMP, and just a matter
> of following the other examples in its atomic.h to add them. sparc64
> is missing the add and sub (which neither of us particularly need),
> I think just because nobody was using them: easily added - I think
> it'd be a good idea for all architectures to have the set of four.
>
> Hirokazu-San,
>
> That leaves your m32r architecture without them: are those functions
> which you could easily add to the m32r atomic.h, or would there be a
> problem with them? I'd hate to break your newly-arrived architecture!
>
> Thanks,
> Hugh
>
next prev parent reply other threads:[~2004-09-10 4:05 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <Pine.LNX.4.44.0409092005430.14004-100000@localhost.localdomain>
2004-09-10 3:26 ` [PATCH] atomic_inc_return() for i386[1/5] " Kaigai Kohei
2004-09-10 5:34 ` Chris Wedgwood
2004-09-11 23:05 ` Andrew Morton
2004-09-12 8:25 ` Andi Kleen
2004-09-12 9:06 ` Andrew Morton
2004-09-10 3:27 ` [PATCH] atomic_inc_return() for x86_64[2/5] " Kaigai Kohei
2004-09-10 3:29 ` [PATCH] atomic_inc_return() for arm[3/5] " Kaigai Kohei
2004-09-10 3:30 ` [PATCH] atomic_inc_return() for arm26[1/5] " Kaigai Kohei
2004-09-10 3:32 ` [PATCH] atomic_inc_return() for sparc64[5/5] " Kaigai Kohei
2004-09-10 5:26 ` David S. Miller
2004-09-10 4:05 ` Kaigai Kohei [this message]
2004-09-10 6:37 ` PATCH] atomic_inc_return() [0/5] " Hugh Dickins
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='01be01c496eb$6a9dbd60$f97d220a@linux.bs1.fc.nec.co.jp' \
--to=kaigai@ak.jp.nec.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®