From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751057AbdGZE0Q (ORCPT ); Wed, 26 Jul 2017 00:26:16 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:44483 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750747AbdGZE0P (ORCPT ); Wed, 26 Jul 2017 00:26:15 -0400 Subject: Re: [PATCH V2] selftests/vm: Add tests to validate mirror functionality with mremap To: Michal Hocko , Anshuman Khandual References: <20170725063657.3915-1-khandual@linux.vnet.ibm.com> <20170725133604.GA27322@dhcp22.suse.cz> Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, akpm@linux-foundation.org, mike.kravetz@oracle.com From: Anshuman Khandual Date: Wed, 26 Jul 2017 09:54:26 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <20170725133604.GA27322@dhcp22.suse.cz> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-TM-AS-MML: disable x-cbid: 17072604-1617-0000-0000-000001F8D6EC X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17072604-1618-0000-0000-000048425929 Message-Id: <32236948-422c-3519-7be3-88527895bf92@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-07-26_02:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1706020000 definitions=main-1707260065 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Yes, once Mike's patch is merged, it will fail during the mremap() call itself IIUC. I can change this test to verify that mremap() call failure then but now the mismatch of elements between the buffers is what is expected and is happening. But if you would like I can change the test to check for mremap() failure in this case (which will fail in the current mainline but will pass eventually when Mike's patch is in). Please do suggest.