From: Jeff Garzik <jgarzik@pobox.com>
To: M?ns Rullg?rd <mru@users.sourceforge.net>
Cc: linux-kernel@vger.kernel.org
Subject: Re: how to turn off, or to clear read cache?
Date: Wed, 20 Aug 2003 13:17:13 -0400 [thread overview]
Message-ID: <20030820171713.GA21822@gtf.org> (raw)
In-Reply-To: <yw1xptj0b72s.fsf@users.sourceforge.net>
On Wed, Aug 20, 2003 at 06:57:15PM +0200, M?ns Rullg?rd wrote:
> Luciano Miguel Ferreira Rocha <luciano@lsd.di.uminho.pt> writes:
> > Will it clear the cache?
>
> It will probably clear some cache to make room for cache from hda.
>
> perl -e '@f[0..100000000]=0'
>
> will do it faster.
Using fillmem will do it better :)
Jeff
/* fillmem.c usage: "fillmem <number-of-megabytes>" */
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
#define MEGS 140 /* default; override on command line */
#define MEG (1024 * 1024)
int main (int argc, char *argv[])
{
void **data;
int i, r;
size_t megs = MEGS;
if ((argc >= 2) && (atoi(argv[1]) > 0))
megs = atoi(argv[1]);
data = malloc (megs * sizeof (void*));
if (!data) abort();
memset (data, 0, megs * sizeof (void*));
srand(time(NULL));
for (i = 0; i < megs; i++) {
data[i] = malloc(MEG);
memset (data[i], i, MEG);
printf("malloc/memset %03d/%03lu\n", i+1, megs);
}
for (i = megs - 1; i >= 0; i--) {
r = rand() % 200;
memset (data[i], r, MEG);
printf("memset #2 %03d/%03lu = %d\n", i+1, megs, r);
}
printf("done\n");
return 0;
}
next prev parent reply other threads:[~2003-08-20 17:17 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-08-20 13:22 how to turn off, or to clear read cache? John Bradford
2003-08-20 13:23 ` Sergey Spiridonov
2003-08-20 13:31 ` Måns Rullgård
2003-08-20 16:49 ` Luciano Miguel Ferreira Rocha
2003-08-20 16:57 ` Måns Rullgård
2003-08-20 17:17 ` Jeff Garzik [this message]
2003-08-20 17:28 ` Måns Rullgård
[not found] <mzNF.3z3.47@gated-at.bofh.it>
[not found] ` <mB2M.4Jv.35@gated-at.bofh.it>
[not found] ` <mCi4.5Kq.3@gated-at.bofh.it>
2003-08-21 10:01 ` Ihar 'Philips' Filipau
-- strict thread matches above, loose matches on Subject: below --
2003-08-20 11:52 Sergey Spiridonov
2003-08-20 12:30 ` Måns Rullgård
2003-08-20 13:11 ` Denis Vlasenko
2003-08-20 14:30 ` Sergey Spiridonov
2003-08-20 22:46 ` Jamie Lokier
2003-08-20 22:52 ` Mike Fedyk
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=20030820171713.GA21822@gtf.org \
--to=jgarzik@pobox.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mru@users.sourceforge.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