public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Rob Landley <landley@trommello.org>
To: Timur Tabi <ttabi@interactivesi.com>, "H. Peter Anvin" <hpa@zytor.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Allocating more than 890MB in the kernel?
Date: Sat, 20 Oct 2001 00:40:57 -0400	[thread overview]
Message-ID: <0110200040570M.15870@localhost.localdomain> (raw)
In-Reply-To: <Pine.LNX.4.30.0110191204210.21846-100000@hill.cs.ucr.edu> <9qq0mo$eun$1@cesium.transmeta.com> <3BD08B57.1070604@interactivesi.com>
In-Reply-To: <3BD08B57.1070604@interactivesi.com>

On Friday 19 October 2001 16:21, Timur Tabi wrote:
> H. Peter Anvin wrote:
> > That's because you're running out of address space, not memory.
> > HIGHMEM doesn't do anything for the latter -- it can't.  You start
> > running into a lot of fundamental problems when your memory size gets
> > in the same (or higher) ballpark than your address space.
> >
> > The best solution is go buy a 64-bit CPU.  There isn't much else you
> > can do about it.
>
> That's completely missing the point of my request (which, I admit, I didn't
> make clear).  I need to allocate about 3/4 of available memory in the
> kernel. If I had 2GB of RAM, I'd need to allocate 1.5GB.  If I had 8 GB of
> RAM, I'd need to allocate 6GB.  I just used 3GB/4GB because it's our
> current test platform.

Each user process has 32 bit pointers for memory.  This means they only have 
4 gigabytes of virtual address space, regardless of how many physical pages 
the machine has.  The kernel doesn't use segment:offset addressing.  It just 
uses the offset.  Flat memory model.

Now your page tables can shuffle memory around (using physical pages, swap, 
etc), but that's irrelevant.  You've still only got 4 gigs of virtual space 
per process to work with on a 32 bit system.  The register you're ultimately 
dereferencing to access memory isn't big enough to hold a number larger than 
that.

To simplify the page tables, the kernel is in shared memory.  The first 
gigabyte of every process's address space is the kernel.  The kernel's page 
table is sort of spliced into everybody's page table.  And there was much 
rejoicing.

The problem is, you're trying to allocate kernel memory, meaning you hit the 
1 gigabyte limit.  And that includes the kernel itself.  You can recompile so 
the kernel has more than 1 gig of everybody's virtual address range reserved 
to it, but that reduces the amount of virtual memory user space processes 
have (4 gigs - 1 gig) because the kernel space (shared memory) is mapped into 
each and every process so the process can access kernel resources easily.  
(You do NOT want to change page tables for every system call.  We're not 
going there.)

To allocate more memory than that, you need to allocate pages in user space.  
To allocate more than 4 gigabytes of memory, you MUST use more than one 
process (you only have 4 gigs of virtual address space per process, so two 
processes must use overlapping virtual address ranges to point to different 
pages.  Perhaps they could communicate with each other through a shared mmap. 
 Congratulations, you've just reinvented expanded memory.)

Or, we could get back to the "buy a real computer" answer everybody's been 
giving you: buy a 64 bit computer that has more than 4 gigabytes of virtual 
address space per process.  Then you have 64 bit pointers for your virtual 
addresses, and can directly address virtual petabytes or exabytes or whatever 
comes next...

Rob

  parent reply	other threads:[~2001-10-20  8:51 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-10-19 18:48 Allocating more than 890MB in the kernel? Timur Tabi
2001-10-19 19:04 ` John Tyner
2001-10-19 19:41   ` Timur Tabi
2001-10-19 19:59     ` H. Peter Anvin
2001-10-19 20:21       ` Timur Tabi
2001-10-19 20:32         ` H. Peter Anvin
2001-10-20  4:40         ` Rob Landley [this message]
2001-10-20 18:09           ` H. Peter Anvin
2001-10-25  4:04         ` Albert D. Cahalan
2001-10-26 16:13           ` Timur Tabi

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=0110200040570M.15870@localhost.localdomain \
    --to=landley@trommello.org \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ttabi@interactivesi.com \
    /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