From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752556AbdEVH1o (ORCPT ); Mon, 22 May 2017 03:27:44 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:39701 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751665AbdEVH1n (ORCPT ); Mon, 22 May 2017 03:27:43 -0400 Subject: Re: [PATCH] mm: introduce MADV_CLR_HUGEPAGE To: Mike Rapoport , Andrew Morton References: <1495433562-26625-1-git-send-email-rppt@linux.vnet.ibm.com> Cc: Arnd Bergmann , "Kirill A. Shutemov" , Andrea Arcangeli , linux-mm , lkml From: Anshuman Khandual Date: Mon, 22 May 2017 12:56:45 +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: <1495433562-26625-1-git-send-email-rppt@linux.vnet.ibm.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-TM-AS-MML: disable x-cbid: 17052207-0012-0000-0000-000002363F9F X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17052207-0013-0000-0000-0000074DA064 Message-Id: <8b21bb9a-4efc-288b-933d-be7e6a5e4a0a@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-05-22_05:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=2 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1703280000 definitions=main-1705220039 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/22/2017 11:42 AM, Mike Rapoport wrote: > Currently applications can explicitly enable or disable THP for a memory > region using MADV_HUGEPAGE or MADV_NOHUGEPAGE. However, once either of > these advises is used, the region will always have > VM_HUGEPAGE/VM_NOHUGEPAGE flag set in vma->vm_flags. > The MADV_CLR_HUGEPAGE resets both these flags and allows managing THP in > the region according to system-wide settings. Invoking madvise() for the first time with either MADV_HUGEPAGE or MADV_NOHUGEPAGE on the buffer will unsubscribe it from the system wide behavior for good. I am not saying we should not have a way to put it back into system wide mode but are there no other functions through madvise() or any other interface which may have the same situation.