lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <5113D739.5070402@msgid.tls.msk.ru>
Date:	Thu, 07 Feb 2013 20:32:57 +0400
From:	Michael Tokarev <mjt@....msk.ru>
To:	Linux-kernel <linux-kernel@...r.kernel.org>
CC:	Serge Hallyn <serge.hallyn@...ntu.com>
Subject: Transparent Huge Pages

Hello.

I'm trying to understand how to use transparent huge pages
(currently in x86).  Before I used "explicit" huge pages
alot (mostly about hugetlbfs), but it looked like THP should
be easier so I gave it a try.

This tiny program:

----- cut -----
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/mman.h>
#include <errno.h>
#include <string.h>

int main(int argc, char **argv) {
   void *ptr;
   size_t len = argv[1] ? atoi(argv[1]) : 1024*1024*1024;
   /* no error checking! */
   posix_memalign(&ptr, 2048*1024, len);
   madvise(ptr, len, MADV_HUGEPAGE);
   memset(ptr, 0, len);
   usleep(500); /* let khugepagesd do its work */
   system("grep ^AnonHugePages: /proc/meminfo");
   return 0;
}
----- cut -----

which just tries to allocate some amount of RAM (1Gb by default)
aligned to 2Mb, uses madvise(HUGEPAGE) on it, and checks
/proc/meminfo for AnonHugePages.

The problem is: I've never seen any value for AnonHugePages
larger than about 16Mb.  Usually it is around 10Mb or 8Mb,
no matter how large the requested memory size is, including
the default 1Gb.

The question, obviously, is: why so small?

My system (which is a few years old now) has 6Gb of RAM,
it uses AMD Athlon II X2 260 CPU, and is running 3.2
kernel.

Original question comes from grounds of of QEMU, which is
supposed to use THP for guest memory, but it also does not
use more than these ~10Mb, when allocating 1Gb to the guest.

Thanks!

/mjt
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ