diff options
author | Hampson, Steven T <steven.t.hampson@intel.com> | 2013-04-29 15:07:47 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-04-29 15:54:35 -0700 |
commit | 1444f92c84984dd13f3e8e121115783ae5b22c55 (patch) | |
tree | 7b8da0e836b0f7562925914f758cced2246bce40 /firmware/radeon/R420_cp.bin.ihex | |
parent | 104ad3b32d7a71941c8ab2dee78eea38e8a23309 (diff) | |
download | op-kernel-dev-1444f92c84984dd13f3e8e121115783ae5b22c55.zip op-kernel-dev-1444f92c84984dd13f3e8e121115783ae5b22c55.tar.gz |
mm: merging memory blocks resets mempolicy
Using mbind to change the mempolicy to MPOL_BIND on several adjacent
mmapped blocks may result in a reset of the mempolicy to MPOL_DEFAULT in
vma_adjust.
Test code. Correct result is three lines containing "OK".
#include <stdio.h>
#include <unistd.h>
#include <sys/mman.h>
#include <numaif.h>
#include <errno.h>
/* gcc mbind_test.c -lnuma -o mbind_test -Wall */
#define MAXNODE 4096
void allocate()
{
int ret;
int len;
int policy = -1;
unsigned char *p;
unsigned long mask[MAXNODE] = { 0 };
unsigned long retmask[MAXNODE] = { 0 };
len = getpagesize() * 0x2fc00;
p = mmap(NULL, len, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS,
-1, 0);
if (p == MAP_FAILED)
printf("mbind err: %d\n", errno);
mask[0] = 1;
ret = mbind(p, len, MPOL_BIND, mask, MAXNODE, 0);
if (ret < 0)
printf("mbind err: %d %d\n", ret, errno);
ret = get_mempolicy(&policy, retmask, MAXNODE, p, MPOL_F_ADDR);
if (ret < 0)
printf("get_mempolicy err: %d %d\n", ret, errno);
if (policy == MPOL_BIND)
printf("OK\n");
else
printf("ERROR: policy is %d\n", policy);
}
int main()
{
allocate();
allocate();
allocate();
return 0;
}
Signed-off-by: Steven T Hampson <steven.t.hampson@intel.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: Andi Kleen <andi@firstfloor.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'firmware/radeon/R420_cp.bin.ihex')
0 files changed, 0 insertions, 0 deletions