From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754116AbdEVIMh (ORCPT ); Mon, 22 May 2017 04:12:37 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:54226 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751771AbdEVIMf (ORCPT ); Mon, 22 May 2017 04:12:35 -0400 Date: Mon, 22 May 2017 11:12:25 +0300 From: Mike Rapoport To: Anshuman Khandual Cc: Andrew Morton , Arnd Bergmann , "Kirill A. Shutemov" , Andrea Arcangeli , linux-mm , lkml Subject: Re: [PATCH] mm: introduce MADV_CLR_HUGEPAGE References: <1495433562-26625-1-git-send-email-rppt@linux.vnet.ibm.com> <8b21bb9a-4efc-288b-933d-be7e6a5e4a0a@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8b21bb9a-4efc-288b-933d-be7e6a5e4a0a@linux.vnet.ibm.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-TM-AS-GCONF: 00 x-cbid: 17052208-0012-0000-0000-00000534FA1E X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17052208-0013-0000-0000-000018915A21 Message-Id: <20170522081223.GD27382@rapoport-lnx> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-05-22_07:,, 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-1705220042 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 22, 2017 at 12:56:45PM +0530, Anshuman Khandual wrote: > 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. There are madvise() interfaces that set or clear some of the vma->vm_flags, e.g MADV_*FORK or MADV_*DUMP. The difference with MADV_*HUGEPAGE is that it is using two flags and with current madvise() interface either of them has to be set, but there is no interface to clear them both. -- Sincerely yours, Mike.