From: Muli Ben-Yehuda <mulix@mulix.org>
To: Andrew Morton <akpm@osdl.org>
Cc: Miles Bader <miles@gnu.org>, Jamie Lokier <jamie@shareable.org>,
Linux-Kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] document optimizing macro for translating PROT_ to VM_ bits
Date: Thu, 2 Oct 2003 14:37:55 +0300 [thread overview]
Message-ID: <20031002113755.GQ29313@actcom.co.il> (raw)
In-Reply-To: <buon0cm1tpm.fsf@mcspd15.ucom.lsi.nec.co.jp>
[-- Attachment #1: Type: text/plain, Size: 1384 bytes --]
On Tue, Sep 30, 2003 at 07:00:53PM +0900, Miles Bader wrote:
> Muli Ben-Yehuda <mulix@mulix.org> writes:
> > I like code that is "future proof", especially when it doesn't cost
> > anything.
>
> Sure, it's not always worth the trouble/pain to do so unless you've
> actually got some reason to think it will be mis-used.
>
> This is seeming more and more like such a case: it's a very special
> purpose macro which is only used by two other small functions, both of
> which are located immediately adjacent to the macro's definition.
After taking the time to cool down from the testosterone rush commonly
induced by micro optimizations, I recon you're right. Andrew, please
apply this documentation only patch against 2.6.0-t6-mm2:
--- linux-2.5/include/linux/mman.h Sun Sep 7 10:05:18 2003
+++ optimizing-macro-2.6.0-t6/include/linux/mman.h Tue Sep 30 09:47:19 2003
@@ -28,8 +28,13 @@
vm_acct_memory(-pages);
}
-/* Optimisation macro. */
-#define _calc_vm_trans(x,bit1,bit2) \
+/*
+ * Optimisation macro. It is equivalent to:
+ * (x & bit1) ? bit2 : 0
+ * but this version is faster.
+ * ("bit1" and "bit2" must be single bits).
+ */
+#define _calc_vm_trans(x, bit1, bit2) \
((bit1) <= (bit2) ? ((x) & (bit1)) * ((bit2) / (bit1)) \
: ((x) & (bit1)) / ((bit1) / (bit2)))
--
Muli Ben-Yehuda
http://www.mulix.org
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
next prev parent reply other threads:[~2003-10-02 11:38 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-09-29 9:06 [PATCH] document optimizing macro for translating PROT_ to VM_ bits Muli Ben-Yehuda
2003-09-29 15:34 ` Jamie Lokier
2003-09-29 15:51 ` Valdis.Kletnieks
2003-09-29 17:11 ` Jamie Lokier
2003-09-29 17:25 ` Maciej Zenczykowski
2003-09-30 2:15 ` Miles Bader
2003-09-30 7:10 ` Muli Ben-Yehuda
2003-09-30 7:34 ` Miles Bader
2003-09-30 7:41 ` Muli Ben-Yehuda
2003-09-30 7:59 ` Miles Bader
2003-09-30 9:24 ` Muli Ben-Yehuda
2003-09-30 10:00 ` Miles Bader
2003-09-30 10:06 ` Miles Bader
2003-10-02 11:37 ` Muli Ben-Yehuda [this message]
2003-09-30 10:35 ` Thomas Schlichter
2003-09-30 8:02 ` Frédéric St-Martin
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=20031002113755.GQ29313@actcom.co.il \
--to=mulix@mulix.org \
--cc=akpm@osdl.org \
--cc=jamie@shareable.org \
--cc=linux-kernel@vger.kernel.org \
--cc=miles@gnu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.