public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] document optimizing macro for translating PROT_ to VM_ bits
@ 2003-09-29  9:06 Muli Ben-Yehuda
  2003-09-29 15:34 ` Jamie Lokier
  0 siblings, 1 reply; 16+ messages in thread
From: Muli Ben-Yehuda @ 2003-09-29  9:06 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Jamie Lokier, Linux-Kernel

[-- Attachment #1: Type: text/plain, Size: 962 bytes --]

In continuation to the thread at
http://marc.theaimsgroup.com/?l=linux-kernel&m=3D106270456516176&w=2 wrt
translating PROT_(censored) bits to VM_(censored) bits, here's a small
comment only patch to document the optimizing macro Jamie's patch
used. Against 2.6.0-t6, but should apply to anything
recent. Compiles.

Cheers,
Muli

--- linux-2.5/include/linux/mman.h	Sun Sep  7 10:05:18 2003
+++ optimizing-macro-2.6.0-t6/include/linux/mman.h	Mon Sep 29 11:53:12 2003
@@ -28,7 +28,10 @@
 	vm_acct_memory(-pages);
 }
 
-/* Optimisation macro. */
+/* Optimisation macro, used to be defined as: */
+/* ((bit1 == bit2) ? (x & bit1) : (x & bit1) ? bit2 : 0) */ 
+/* but this version is faster */ 
+/* "check if bit1 is on in 'x'. If it is, return bit2" */ 
 #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 --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2003-10-02 11:38 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2003-09-30 10:35             ` Thomas Schlichter
2003-09-30  8:02   ` Frédéric St-Martin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox