All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Smietanowski <stesmi@stesmi.com>
To: Bernd Petrovitsch <bernd@firmix.at>
Cc: Bastiaan Naber <naber@inl.nl>, linux-kernel@vger.kernel.org
Subject: Re: a 15 GB file on tmpfs
Date: Thu, 21 Jul 2005 11:12:59 +0200	[thread overview]
Message-ID: <42DF671B.8020809@stesmi.com> (raw)
In-Reply-To: <1121935332.21421.10.camel@tara.firmix.at>

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Bernd Petrovitsch wrote:
> On Wed, 2005-07-20 at 14:16 +0200, Bastiaan Naber wrote:
> [...]
> 
>>I have a 15 GB file which I want to place in memory via tmpfs. I want to do 
>>this because I need to have this data accessible with a very low seek time.
> 
> 
> Apart fromn the 32-vs-64bit thing: Isn't it enough (and simpler and more
> flexible) to mmap(2) that file and mlock(2) it afterwards?
> 
> 	Bernd

On 32bit arches, a pointer is 32bit large.
On 64bit arches, a pointer is 64bit large.

You can't mmap() the whole file if it's larger than 32bit on a 32bit
arch.

 void *mmap(void *start, size_t length, int prot, int flags,
       int fd, off_t offset);

test.c:
#include <sys/mman.h>
int main(void)
{
  printf("sizeof(void *): %d\n", sizeof(void *));
  printf("sizeof(size_t): %d\n", sizeof(size_t));
}

On a 64bit machine:
$ gcc test.c -o test64 ; ./test64; file ./test64
sizeof(void *): 8
sizeof(size_t): 8
test64: ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), for
GNU/Linux 2.4.0, dynamically linked (uses shared libs), not stripped

On a 32bit machine (or in this case, 32bit userland on a 64bit machine):
$ gcc -m32 test.c -o test32 ; ./test32; file ./test32
sizeof(void *): 4
sizeof(size_t): 4
test32: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for
GNU/Linux 2.2.5, dynamically linked (uses shared libs), not stripped

Meaning both the pointer and the size argument are only 32bit (4byte)
on 32-bit arches and 64bit (8 byte) on 64bit arches.

// Stefan
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (MingW32)

iD4DBQFC32caBrn2kJu9P78RAujmAJ9J3xYdbAwYdpGXuu8kiTwdcloaSQCY1TD1
SuJJ3Ylpsa+Cdo2uIQ/Prw==
=IFvd
-----END PGP SIGNATURE-----

  reply	other threads:[~2005-07-21  9:07 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-20 12:16 a 15 GB file on tmpfs Bastiaan Naber
2005-07-20 13:20 ` Erik Mouw
2005-07-20 13:31   ` Antonio Vargas
2005-07-20 13:35   ` Miquel van Smoorenburg
2005-07-20 14:44     ` Erik Mouw
2005-07-20 15:23       ` Antonio Vargas
2005-07-21  2:13         ` Jim Nance
2005-07-20 15:18 ` Jan Engelhardt
2005-07-21  6:25 ` Denis Vlasenko
2005-07-21  8:42 ` Bernd Petrovitsch
2005-07-21  9:12   ` Stefan Smietanowski [this message]
2005-07-21  9:39     ` Bernd Petrovitsch
2005-07-22 10:36 ` Bernd Eckenfels
2005-07-22 11:00   ` Stefan Smietanowski
2005-07-22 16:25     ` Bernd Eckenfels
2005-07-22 21:10       ` Stefan Smietanowski
  -- strict thread matches above, loose matches on Subject: below --
2005-07-21 15:25 Andrew Burgess
2005-07-22  9:39 Cabaniols, Sebastien
2005-07-22 10:38 linux

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=42DF671B.8020809@stesmi.com \
    --to=stesmi@stesmi.com \
    --cc=bernd@firmix.at \
    --cc=linux-kernel@vger.kernel.org \
    --cc=naber@inl.nl \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.