Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755883AbbGFVe4 (ORCPT ); Mon, 6 Jul 2015 17:34:56 -0400 Received: from mail-bl2on0122.outbound.protection.outlook.com ([65.55.169.122]:13408 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751729AbbGFVes (ORCPT ); Mon, 6 Jul 2015 17:34:48 -0400 Authentication-Results: gmail.com; dkim=none (message not signed) header.d=none; Message-ID: <1436218475.2658.14.camel@freescale.com> Subject: Re: [RFC PATCH 6/6] powerpc/kvm: change the condition of identifying hugetlb vm From: Scott Wood To: wenwei tao CC: Izik Eidus , , , Hugh Dickins , , , , , , , , , , , Date: Mon, 6 Jul 2015 16:34:35 -0500 In-Reply-To: References: <1433917639-31699-1-git-send-email-wenweitaowenwei@gmail.com> <1433917639-31699-7-git-send-email-wenweitaowenwei@gmail.com> <1435873760.10531.11.camel@freescale.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.16.0-fta1 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Originating-IP: [2601:448:8100:f9f:12bf:48ff:fe84:c9a0] X-ClientProxiedBy: SN2PR10CA0014.namprd10.prod.outlook.com (25.160.12.152) To BY1PR03MB1484.namprd03.prod.outlook.com (25.162.210.142) X-Microsoft-Exchange-Diagnostics: 1;BY1PR03MB1484;2:2hKFFgUOVBedyrohJHiIupc1bkfvrKO8wc8M5RONSPFJcDsVkCdqkOGy1+Ejdzbd;3:+YPzToSInU+0NYroGo/pDs3/V6S86h0XMLAg/u4vXALxQwRBtdBpBKNV8KBOBnRgeNubB8bNI/IP3vR2zvK7EUzOusTtSIhGXOs0R6BXtKebQ8ucDopfNvo6zp6XYg9UlmTo0zRrO800QnxQrV+Cbg==;20:bZT7iz0LuY4Nsi9+E34Df0KUwUjpApolqvvJXNPuIEk1INvv0is6vgA6qbIXGqOjLU9A6KXEYpnZ5FtmEMqxEimrYHzoVMSoIIIcuH25t32IGcL99EJ/os1/3rJOPHU1r0KtBFpO1a7l5LN3oo6SZ86b8kx4YIvvxbKGk4uy+bNwHPfRZq9XCkMh525rgqbyNtdK9M77tlgFDIy4NSIW37WSOc76/9wxLR+bianAJ9v+3N+WVvLt0VN/iRWX7iNkBz9SL3UpNYCEKmxIkIpSrm1V9v1ySXrg2dfvxPnsRy5iKmbY45pteJvwTCB2XgMHW9I3H6VbJqxFbuXTJuJ0WED78P7LoSPg+wcoQ8RMpuCykAjjpOgMyZX64yoM60zifmlbgnTwIpV5QdAotWSr69JKtAtYvr+1+eDundaNejmjDcVaULw8RvfFu3tn8NWOPnTO3i/mhh/ZGRkVTHd239Xva0Z8PuqBCJaijD5+k+SDL9BYRDcfiUUNkZiiRjFX X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY1PR03MB1484; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(5005006)(3002001);SRVR:BY1PR03MB1484;BCL:0;PCL:0;RULEID:;SRVR:BY1PR03MB1484; X-Microsoft-Exchange-Diagnostics: 1;BY1PR03MB1484;4:bTQZ2K3aFzxiKeaYB0sqsMCR92ozm9Wf8XuaLPVhEnpC8TK94TvaqVhOxM3+bHeqy49V9s2cfD19Qj926y1UrV7qkMw96B1UibHbTUKokYeiDu3HhTyii84IujDKhhWamIsx6IiUQr3/EQfRsNSroJwT9T71HWer3aFynVz4xCQbr74DvxyWJRcB0etOMu+bjPY78VrPn5Q0hixgoGtAbT3O72P4HvkYJkVWfHdH5BjlAnybiONkrGFSMDqtKfGsqWNBLi3fXJsU5QW/rkCW9KzKYxHc5QvLo19oAaCyfXg= X-Forefront-PRVS: 06290ECA9D X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(6009001)(51704005)(377424004)(24454002)(36756003)(110136002)(33646002)(5820100001)(50466002)(76176999)(189998001)(50986999)(77096005)(46102003)(92566002)(2950100001)(47776003)(77156002)(5001960100002)(86362001)(23676002)(42186005)(62966003)(87976001)(122386002)(93886004)(1411001)(50226001)(103116003)(40100003)(3826002)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:BY1PR03MB1484;H:[IPv6:2601:448:8100:f9f:12bf:48ff:fe84:c9a0];FPR:;SPF:None;MLV:sfv;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;BY1PR03MB1484;23:p19vobF9HTG7PKYYNq9vEg6M7hypz15mb9ZGplf489JeunDl71Lph6JKMW8seS5OueWuWpqAAXJALKUibHYECUEzjzu/i0VlU8nY2d10JDEmlP+wSYHflEzA/8s7yPstja/VU/YUh/S6fr6K54p2dhzO5ozPtXdZCs9GPW/dV+RoEzdvfNiGavtXvjR+qQLiDSMIb6Y2JdOtrkhJkST+SrIKYxM1GagtkhFpYDayJM/xojX2FdEgh+iFd1TS4fys180XX/rBQtZCJ6GPiz0IKLmoCa6/6BVRCqN/7l+BOkEne15eCwhdMwdMkL1pfeSVn5rTF7S3vcwWTybcYxjv9+yImf3afvKfZwEY7SuzEQxjTXT02zjQ9wwoVsxic9cvCU0ob4AUESqIEOEnSe1Dy/64pg+6n9Lg+/FfqWkCoGivrqVJKYZg9XqtDwfvHFYhXR4E7n9RtHr696C2UYh63rZnzMNCBHUkLYaxfymcmJ20Y3lWuuQZ9/Lz0Fef1HGJumt/e21V2KdSbX68zWw45LziP4kdEx0ViwfCYyv27OqGXJ2iVvxTblmLai69doCEZr9yn3qVcgXVIQShsEvH1LndnN9drzKnnY9pS/v1PEfJ0JP8uF++dCnTJS5cUpDy9KekOOsZdogPRoo3WGqA0g2LHo4MWq1OnwK6/ZDSNNssgCQLTx+v+VXmBEqdwXONDzb/y3VGze7l6Xn7H837zjGBkQMZwG7P3zxr2CZc2t+5guauojxu6r8eFF0/oH9xANfAkUHcFqvPSuqektuHZdFVn4SOe+nPT+o6Ztuk1jQ45AekrO8FQToayMb+6jzCXu9gBrTjjDlNgof8NEjlabMm6OYMfaNa/6CdSlZHRxI= X-Microsoft-Exchange-Diagnostics: 1;BY1PR03MB1484;5:+P25dfzH//dSWZv+Vy2fn6bWlG2ZGAfPRQo3jor0fhgY02dSEe3RdYfKFHtjom1dFuAN26Udd75+xuvtv7QYGqjJ1QVk0MVAyJ7Pp2ldQT+vgSQVUykGYUz3L/BVpD/134VsJiWktOAk+5EO0iIzJQ==;24:rJkO8tMCT+NnZugzMSEVZWmIT8u/yKKr2NVGv59et/oXBbmQrB7rEnbvPAmXh5i6Onzs8XPu2AqJg/Gz9EhHmaiJiHWeyXdlZLwKIhdjcQY=;20:Fu0nJ6u9IBCTyK1dLb8M2B4y43l4olBvzCdCe8qCxkF6qb7fBN20mqpvHl5Hj+EIm/cAWrkd8h7J9dFkKMwX8A== X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jul 2015 21:34:42.0768 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR03MB1484 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1203 Lines: 30 On Fri, 2015-07-03 at 16:47 +0800, wenwei tao wrote: > Hi Scott > > Thank you for your comments. > > Kernel already has that function: is_vm_hugetlb_page() , but the > original code didn't use it, > in order to keep the coding style of the original code, I didn't use it > either. > > For the sentence like: "vma->vm_flags & VM_HUGETLB" , hiding it behind > 'is_vm_hugetlb_page()' is ok, > but the sentence like: "vma->vm_flags & > (VM_LOCKED|VM_HUGETLB|VM_PFNMAP)" appears in the patch 2/6, > is it better to hide the bit combinations behind the > is_vm_hugetlb_page() ? In my patch I just replaced it with > "vma->vm_flags & (VM_LOCKED|VM_PFNMAP) || (vma->vm_flags & > (VM_HUGETLB|VM_MERGEABLE)) == VM_HUGETLB". If you're going to do non-obvious things with the flags, it should be done in one place rather than throughout the code. Why would you do the above and not "vma->vm_flags & (VM_LOCKED | VM_PFNMAP) || is_vm_hugetlb_page(vma)"? -Scott -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/