Re: [PATCH V2] selftests/vm: Add tests to validate mirror functionality with mremap

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed 26-07-17 09:54:26, Anshuman Khandual wrote:
> On 07/25/2017 07:06 PM, Michal Hocko wrote:
> > On Tue 25-07-17 12:06:57, Anshuman Khandual wrote:
> > [...]
> >> diff --git a/tools/testing/selftests/vm/mremap_mirror_private_anon.c b/tools/testing/selftests/vm/mremap_mirror_private_anon.c
> > [...]
> >> +	ptr = mmap(NULL, alloc_size, PROT_READ | PROT_WRITE,
> >> +			MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
> >> +	if (ptr == MAP_FAILED) {
> >> +		perror("map() failed");
> >> +		return -1;
> >> +	}
> >> +	memset(ptr, PATTERN, alloc_size);
> >> +
> >> +	mirror_ptr =  (char *) mremap(ptr, 0, alloc_size, MREMAP_MAYMOVE);
> >> +	if (mirror_ptr == MAP_FAILED) {
> >> +		perror("mremap() failed");
> >> +		return -1;
> >> +	}
> > 
> > What is the point of this test? It will break with Mike's patch very
> > soon. Btw. it never worked.
> 
> It works now. The new 'mirrored' buffer does not have same elements
> as that of the original one.

So what exactly are you testing here? The current implementation or the
semantic of mremap. Because having a different content after mremap
doesn't make _any_ sense to me. I might be misreading the intention of
the syscall but to me it sounds like the content should be same as the
original one... If my reading is wrong then -EINVAL for anon mremaps is
simply wrong.
-- 
Michal Hocko
SUSE Labs

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]
  Powered by Linux