Subject: Re: [PATCH] selfttest/powerpc: Add memory page migration tests

From: "Aneesh Kumar K.V" <[email-masked]>
Date: Fri, 16 Oct 2015 17:09:51 +0530

Anshuman Khandual <[email-masked]> writes:

> On 10/15/2015 09:16 PM, Anshuman Khandual wrote:
>> This adds two tests for memory page migration. One for normal page
>> migration which works for both 4K or 64K base page size kernel and
>> the other one is for 16MB huge page migration which will work both
>> 4K or 64K base page sized 16MB huge pages as and when we support
>> huge page migration.
>> 
>> Signed-off-by: Anshuman Khandual <[email-masked]>
>> ---
>> - Works for normal page migration on both 64K and 4K base pages
>> - Works for 16MB huge page migration (64K) on Aneesh's V2 PTE changes
>> 
>> +
>> +int test_migration(unsigned long length)
>> +{
>> +	unsigned long failed;
>> +	void *addr;
>> +	int ret;
>> +
>> +	addr = mmap(MMAP_ADDR, length, MMAP_PROT, MMAP_FLAGS, -1, 0);
>> +	if (addr == MAP_FAILED) {
>> +		perror("mmap() failed");
>> +		exit(-1);
>> +	}
>
> Will add a mlock() call here as well. Some times soft offline
> fails while trying to move a huge chunk of memory on a system
> because of swapping. With a mlock() in there the problem gets
> resolved.

Is that with respect to hugetlb pages ? I doubt, because hugetlb pages
are not swapped out.

-aneesh