Re: [4.4, 4.5, 4.6] Regression: encrypted swap (dm-crypt) freezes system while under memory pressure and swapping

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

#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@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/dm-devel

[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux