lkml.org 
[lkml]   [2004]   [Aug]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [patch] voluntary-preempt-2.6.8.1-P0

* Lee Revell <rlrevell@joe-job.com> wrote:

> On Sun, 2004-08-15 at 22:58, Ingo Molnar wrote:
> > * Ingo Molnar <mingo@elte.hu> wrote:
> > i've attached mlock-test2.cc that should test this theory. The code
> > breaks up the mlock-ed region into 8 equal pieces and does mlock() on
> > them separately. It's basically a lock-break done in user-space. Does
> > this change the nature of xruns?
>
> -ENOATTACHMENT

-ESTILLTOOEARLY. attached now.

Ingo
// here is the code i used to test the mlockall caused xruns
#include <sys/mman.h>
#include <iostream>
#include <sstream>
#include <unistd.h>

#define INTERVALS 8

int main (int argc, char *argv[]) {
if (argc < 2) {
std::cout << "how many kbytes you want allocated and mlockall'ed?" << std::endl;
}

std::stringstream stream(argv[1]);
int kbytes, error = 0, i, chunk;

stream >> kbytes;
char *mem = new char[kbytes*1024];
std::cout << "filling with 0's" << std::endl;
for (int i = 0; i < kbytes*1024; ++i) {
mem[i] = 0;
}

std::cout << "ok, you want " << kbytes << "kb of memory mlocked. going for it.." << std::endl;
chunk = kbytes*1024/INTERVALS;
for (i = 0; i < INTERVALS; i++)
error |= mlock(mem + i*chunk, chunk);
if (error != 0) { std::cout << "mlock error" << std::endl; }
else { std::cout << "mlock successfull" << std::endl;}
}

\
 
 \ /
  Last update: 2005-03-22 14:05    [from the cache]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and my Meterkast|Read the blog