public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Muli Ben-Yehuda <mulix@mulix.org>
To: Andrew Morton <akpm@osdl.org>
Cc: Jamie Lokier <jamie@shareable.org>,
	Linux-Kernel <linux-kernel@vger.kernel.org>
Subject: [PATCH] document optimizing macro for translating PROT_ to VM_ bits
Date: Mon, 29 Sep 2003 12:06:30 +0300	[thread overview]
Message-ID: <20030929090629.GF29313@actcom.co.il> (raw)

[-- 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 --]

             reply	other threads:[~2003-09-29  9:07 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-29  9:06 Muli Ben-Yehuda [this message]
2003-09-29 15:34 ` [PATCH] document optimizing macro for translating PROT_ to VM_ bits 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

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=20030929090629.GF29313@actcom.co.il \
    --to=mulix@mulix.org \
    --cc=akpm@osdl.org \
    --cc=jamie@shareable.org \
    --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