Re: [patch] voluntary-preempt-2.6.8.1-P0

Ingo Molnar
2004-08-16T03:19:42Z

[-- Attachment #1: Type: text/plain, Size: 217 bytes --]

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

> > did you try mlock-test.cc too? Just to make sure that mlock-test.cc is
> > equivalent to mlockall-test.cc.
>
> That attachment was also missing.

attached now.

Ingo

[-- Attachment #2: mlock-test.cc --]
[-- Type: text/plain, Size: 868 bytes --]

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

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;
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;
int error = mlock(mem, kbytes*1024);
if (error != 0) { std::cout << "mlock error" << std::endl; }
else { std::cout << "mlock successfull" << std::endl;}
}