https://linen.dev/ logo
current code is this: ```c len = buf_size * nr_buf...
# general
c
current code is this:
Copy code
c
len = buf_size * nr_bufs;
if (use_huge) {
    cbr->buf = mmap(NULL, len, PROT_READ|PROT_WRITE,
            MAP_PRIVATE|MAP_HUGETLB|MAP_HUGE_2MB|MAP_ANONYMOUS,
            -1, 0);
    if (cbr->buf == MAP_FAILED) {
        perror("mmap");
        return 1;
    }
} else {
    if (posix_memalign(&cbr->buf, page_size, len)) {
        perror("posix memalign");
        return 1;
    }
}
i was wondering if a loop(nr_bufs) + malloc is that different