Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 8 Mar 2005 19:35:58 +0530
From:      Ravi Krishna <ravikrish@gmail.com>
To:        hackers@freebsd.org
Subject:   using segmentation to manage memory in FreeBSD
Message-ID:  <6669fd8605030806056b53307a@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
Hi all!

I would like to know if FreeBSD allows one to use segmentation on x86
to reduce the penalty of context switches. (please read on for
details)

Virtual memory on x86 can be managed by either segmentation or by paging. 

when using paging a context switch from one process to other all the
TLB mappings stored in TLB cache are flushed, this makes context the
switch expensive (we will have lots of TLB misses).
There are situations when individual processes donot have large memory
requirements . Some processors have TLB tagging, so OS doesnot flush
all the TLB entries when a context switch happens, only selective ones
are flushed. Unfortunatly Intex x86 does not have TLB tagging
available.

The way to implement something similar on x86 is using segmentation.
say I have four modules
A, B, C, D each needing 100MB address.   I can give each of these a
100MB segment. Assuming TLB cache is large enough to store TLB
mappings for all of these four, to context switch (say frm A to B) I
can just switch the segment, by setting segmentation registers.
These there will be no TLB flush. When we come back frm B to A again
we switch the segment. Now again to TLB flush will happen and A will
be able to use the TLB cache entries for its segment.

This becomes more attractive for 64 bit systems.

My question is that is this functionality available on FreeBSD in any way?

Ravi



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6669fd8605030806056b53307a>