[prev in list] [next in list] [prev in thread] [next in thread] 

List:       dm-devel
Subject:    Re: [dm-devel] [4.4, 4.5, 4.6] Regression: encrypted swap (dm-crypt) freezes system while
From:       Matthias Dahl <ml_linux-dm-devel () binary-island ! eu>
Date:       2016-04-28 9:24:58
Message-ID: ac588d84-2610-cc50-1ec9-5e6097ce5f99 () binary-island ! eu
[Download RAW message or body]

Hello Ondrej...

Sorry, I somehow managed to sent you the wrong version of the little C
program. I wanted to clean it up before sending it and you got a nice
in-between version between the old and new one. :-)

Double-checked now, that's the right one. Sorry.

Have a nice day,
Matthias

-- 
Dipl.-Inf. (FH) Matthias Dahl | Software Engineer | binary-island.eu
 services: custom software [desktop, mobile, web], server administration


["main.cpp" (text/x-c++src)]

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

int main(int argc, char** argv)
{
    unsigned long chunkSize = 1 << 20;       // 1 MiB per \ total mem alloc
    unsigned long maxRuns   = 8 * (1 << 10); // 2^10 runs / of 8 GiB
    void* buffer  = NULL;

    if(argc == 3)
    {
        chunkSize = strtoul(argv[1], NULL, 10);
        maxRuns   = strtoul(argv[2], NULL, 10);
    }

    unsigned long maxMemAllocInBytes = chunkSize * maxRuns;
    unsigned long maxMemAllocInMB    = maxMemAllocInBytes / (1 << 20);
    unsigned long curMemAllocInBytes = 0;

    while(curMemAllocInBytes < maxMemAllocInBytes)
    {
        buffer = malloc(chunkSize);
        memset(buffer, 0, chunkSize);

        curMemAllocInBytes += chunkSize;
        printf("%lu MB / %lu MiB allocated (%lu bytes).\n", (curMemAllocInBytes / (1 \
<< 20)), maxMemAllocInMB, curMemAllocInBytes);

        usleep(500);
    }

    return 0;
}



--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic