9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: erik quanstrom <quanstro@quanstro.net>
To: 9fans@9fans.net
Subject: [9fans] cheep improvement for rendezvous
Date: Sat,  7 Feb 2015 19:40:18 -0800	[thread overview]
Message-ID: <69843e47be3910b56936d8be9e99391f@brasstown.quanstro.net> (raw)

i noticed this today by inspection.  the tag passed to rendezvous is usually
a naturally-aligned address.  for the same size rendhash, we can get shorter
hash chains for the usual case by dropping the low-order bits.

the "2" assumes 32 bits, and should really be replaced by log2ciel(sizeof(uintptr)).
but that's not constant.

/n/dump/2015/0207/sys/src/nix/port/portdat.h:489,495 - ../port/portdat.h:489,496
  	PGHLOG  =	9,
  	PGHSIZE	=	1<<PGHLOG,	/* Page hash for image lookup */
  };
- #define REND(p,s)	((p)->rendhash[(s)&((1<<RENDLOG)-1)])
+ /*
+  * assume natural alignment for minimum sized pointer
+  * 2 is a stand in for log2ciel(sizeof(uintptr))
+  */
+ #define REND(p,s)	((p)->rendhash[((s)>>2)&((1<<RENDLOG)-1)])
  #define MOUNTH(p,qid)	((p)->mnthash[(qid).path&((1<<MNTLOG)-1)])

  struct Pgrp


- erik



                 reply	other threads:[~2015-02-08  3:40 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=69843e47be3910b56936d8be9e99391f@brasstown.quanstro.net \
    --to=quanstro@quanstro.net \
    --cc=9fans@9fans.net \
    /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;
as well as URLs for NNTP newsgroup(s).