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

Anshuman Khandual khandual at linux.vnet.ibm.com
Mon Jan 25 22:10:07 AEDT 2016


On 11/24/2015 01:42 PM, Denis Kirjanov wrote:
> On 11/24/15, Anshuman Khandual <khandual at linux.vnet.ibm.com> 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 <khandual at linux.vnet.ibm.com>


>> +
>> +static unsigned long get_npages(unsigned long length, unsigned long size)
>> +{
>> +	unsigned int tmp1 = length, tmp2 = size;
> I think we want unsigned long here but this is very minor nit

Its been some time now, remember using some tricks to get the
division right. Now that Aneesh's new PTE changes are merged,
will try the Hugetlb migration again and enable the self tests
for them.

>> +
>> +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);
>> +	}
>> +
>> +	write_buffer(addr, length);
>> +	soft_offline_pages(HPAGE_OFF, addr, length/getpagesize(), &failed);
> You've defined get_npages() so I assume it has to be used or not used at all

>> +	npages = get_npages(length, PAGE_SIZE_HUGE);

Its used here.



More information about the Linuxppc-dev mailing list