From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751090AbdEaGaM (ORCPT ); Wed, 31 May 2017 02:30:12 -0400 Received: from mx2.suse.de ([195.135.220.15]:50771 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750778AbdEaGaL (ORCPT ); Wed, 31 May 2017 02:30:11 -0400 Subject: Re: [PATCH] mm: introduce MADV_CLR_HUGEPAGE To: Andrea Arcangeli , Michal Hocko Cc: Mike Rapoport , "Kirill A. Shutemov" , Andrew Morton , Arnd Bergmann , "Kirill A. Shutemov" , Pavel Emelyanov , linux-mm , lkml , Linux API References: <20170524103947.GC3063@rapoport-lnx> <20170524111800.GD14733@dhcp22.suse.cz> <20170524142735.GF3063@rapoport-lnx> <20170530074408.GA7969@dhcp22.suse.cz> <20170530101921.GA25738@rapoport-lnx> <20170530103930.GB7969@dhcp22.suse.cz> <20170530140456.GA8412@redhat.com> <20170530143941.GK7969@dhcp22.suse.cz> <20170530145632.GL7969@dhcp22.suse.cz> <20170530160610.GC8412@redhat.com> From: Vlastimil Babka Message-ID: Date: Wed, 31 May 2017 08:30:08 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 MIME-Version: 1.0 In-Reply-To: <20170530160610.GC8412@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/30/2017 06:06 PM, Andrea Arcangeli wrote: > > I'm not sure if it should be considered a bug, the prctl is intended > to use normally by wrappers so it looks optimal as implemented this > way: affecting future vmas only, which will all be created after > execve executed by the wrapper. > > What's the point of messing with the prctl so it mangles over the > wrapper process own vmas before exec? Messing with those vmas is pure > wasted CPUs for the wrapper use case which is what the prctl was > created for. > > Furthermore there would be the risk a program that uses the prctl not > as a wrapper and then calls the prctl to clear VM_NOHUGEPAGE from > def_flags assuming the current kABI. The program could assume those > vmas that were instantiated before disabling the prctl are still with > VM_NOHUGEPAGE set (they would not after the change you propose). > > Adding a scan of all vmas to PR_SET_THP_DISABLE to clear VM_NOHUGEPAGE > on existing vmas looks more complex too and less finegrined so > probably more complex for userland to manage I would expect the prctl wouldn't iterate all vma's, nor would it modify def_flags anymore. It would just set a flag somewhere in mm struct that would be considered in addition to the per-vma flags when deciding whether to use THP. We could consider whether MADV_HUGEPAGE should be able to override the prctl or not. > but ignoring all above > considerations it would be a functional alternative for CRIU's > needs. However if you didn't like the complexity of the new madvise > which is functionally a one-liner equivalent to MADV_NORMAL, I > wouldn't expect you to prefer to make the prctl even more complex with > a loop over all vmas that despite being fairly simple it'll still be > more than a trivial one liner. > > Thanks, > Andrea > > -- > To unsubscribe, send a message with 'unsubscribe linux-mm' in > the body to majordomo@kvack.org. For more info on Linux MM, > see: http://www.linux-mm.org/ . > Don't email: email@kvack.org > From mboxrd@z Thu Jan 1 00:00:00 1970 From: Vlastimil Babka Subject: Re: [PATCH] mm: introduce MADV_CLR_HUGEPAGE Date: Wed, 31 May 2017 08:30:08 +0200 Message-ID: References: <20170524103947.GC3063@rapoport-lnx> <20170524111800.GD14733@dhcp22.suse.cz> <20170524142735.GF3063@rapoport-lnx> <20170530074408.GA7969@dhcp22.suse.cz> <20170530101921.GA25738@rapoport-lnx> <20170530103930.GB7969@dhcp22.suse.cz> <20170530140456.GA8412@redhat.com> <20170530143941.GK7969@dhcp22.suse.cz> <20170530145632.GL7969@dhcp22.suse.cz> <20170530160610.GC8412@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20170530160610.GC8412@redhat.com> Content-Language: en-US Sender: owner-linux-mm@kvack.org To: Andrea Arcangeli , Michal Hocko Cc: Mike Rapoport , "Kirill A. Shutemov" , Andrew Morton , Arnd Bergmann , "Kirill A. Shutemov" , Pavel Emelyanov , linux-mm , lkml , Linux API List-Id: linux-api@vger.kernel.org On 05/30/2017 06:06 PM, Andrea Arcangeli wrote: > > I'm not sure if it should be considered a bug, the prctl is intended > to use normally by wrappers so it looks optimal as implemented this > way: affecting future vmas only, which will all be created after > execve executed by the wrapper. > > What's the point of messing with the prctl so it mangles over the > wrapper process own vmas before exec? Messing with those vmas is pure > wasted CPUs for the wrapper use case which is what the prctl was > created for. > > Furthermore there would be the risk a program that uses the prctl not > as a wrapper and then calls the prctl to clear VM_NOHUGEPAGE from > def_flags assuming the current kABI. The program could assume those > vmas that were instantiated before disabling the prctl are still with > VM_NOHUGEPAGE set (they would not after the change you propose). > > Adding a scan of all vmas to PR_SET_THP_DISABLE to clear VM_NOHUGEPAGE > on existing vmas looks more complex too and less finegrined so > probably more complex for userland to manage I would expect the prctl wouldn't iterate all vma's, nor would it modify def_flags anymore. It would just set a flag somewhere in mm struct that would be considered in addition to the per-vma flags when deciding whether to use THP. We could consider whether MADV_HUGEPAGE should be able to override the prctl or not. > but ignoring all above > considerations it would be a functional alternative for CRIU's > needs. However if you didn't like the complexity of the new madvise > which is functionally a one-liner equivalent to MADV_NORMAL, I > wouldn't expect you to prefer to make the prctl even more complex with > a loop over all vmas that despite being fairly simple it'll still be > more than a trivial one liner. > > Thanks, > Andrea > > -- > To unsubscribe, send a message with 'unsubscribe linux-mm' in > the body to majordomo@kvack.org. For more info on Linux MM, > see: http://www.linux-mm.org/ . > Don't email: email@kvack.org > -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org