From: Peter Zaitsev <pz@spylog.ru>
To: Andrew Morton <akpm@zip.com.au>
Cc: linux-kernel@vger.kernel.org
Subject: Re[2]: MMAP issues
Date: Tue, 27 Nov 2001 20:54:24 +0300 [thread overview]
Message-ID: <149725995035.20011127205424@spylog.ru> (raw)
In-Reply-To: <3C03D108.E3FADE95@zip.com.au>
In-Reply-To: <183721898675.20011127194607@spylog.ru> <3C03D108.E3FADE95@zip.com.au>
Hello Andrew,
Tuesday, November 27, 2001, 8:44:40 PM, you wrote:
OK. Of course. It's just a few lines length:
Just mention to create any "test.dat" file in the current directory;
#include <stdio.h>
#include <unistd.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
int main()
{
int i=0;
void* p;
int t;
int fd;
t=time(NULL);
while(1)
{
fd=open("test.dat",O_RDWR);
if (fd<0)
{
puts("Unable to open file !");
return;
}
p=mmap(NULL,4096, PROT_READ | PROT_WRITE , MAP_PRIVATE ,fd ,0);
if ((int)p==-1)
{
printf("Failed %d\n",errno);
return;
}
i++;
if (i%10000==0)
{
printf(" %d Time: %d\n",i,time(NULL)-t);
t=time(NULL);
}
}
}
AM> Peter Zaitsev wrote:
>>
>> Hello ,
>>
>> I'm trying to write a program which uses mmap agressively to mmap
>> files (really it's used as fail safe memory allocator to store data
>> if application failed)
>>
AM> It would really help if you could make your test application available to
AM> the kernel developers.
AM> Thanks.
Additionally the interesting thing is - if I change MMAP params to:
p=mmap(NULL,4096, PROT_READ | PROT_WRITE , MAP_PRIVATE | MAP_ANON ,-1 ,0);
(The only change is mapping done ammoniums instead of mmaping a file
- this increases speed really much and it does not decrease)
--
Best regards,
Peter mailto:pz@spylog.ru
next prev parent reply other threads:[~2001-11-27 17:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <3C03D108.E3FADE95@zip.com.au>
2001-11-27 16:46 ` Peter Zaitsev
2001-11-27 17:54 ` Peter Zaitsev [this message]
2001-11-27 22:36 ` Jeff Epler
2001-11-28 9:44 ` Re[2]: " Peter Zaitsev
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=149725995035.20011127205424@spylog.ru \
--to=pz@spylog.ru \
--cc=akpm@zip.com.au \
--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
all inboxes | Powered by JetHome®