From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from psmtp.com (na3sys010amx122.postini.com [74.125.245.122]) by kanga.kvack.org (Postfix) with SMTP id 85DA16B0034 for ; Sun, 14 Jul 2013 15:27:45 -0400 (EDT) Received: by mail-ob0-f172.google.com with SMTP id wo10so12982640obc.17 for ; Sun, 14 Jul 2013 12:27:44 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <20130714141154.GA29815@redhat.com> References: <1373596462-27115-1-git-send-email-ccross@android.com> <1373596462-27115-2-git-send-email-ccross@android.com> <20130714141154.GA29815@redhat.com> Date: Sun, 14 Jul 2013 12:27:44 -0700 Message-ID: Subject: Re: [PATCH 2/2] mm: add a field to store names for private anonymous memory From: Colin Cross Content-Type: text/plain; charset=ISO-8859-1 Sender: owner-linux-mm@kvack.org List-ID: To: Oleg Nesterov Cc: lkml , Kyungmin Park , Christoph Hellwig , John Stultz , "Eric W. Biederman" , Pekka Enberg , Dave Hansen , Rob Landley , Andrew Morton , Cyrill Gorcunov , David Rientjes , Davidlohr Bueso , Kees Cook , Al Viro , Hugh Dickins , Mel Gorman , Michel Lespinasse , Rik van Riel , Konstantin Khlebnikov , Peter Zijlstra , "Paul E. McKenney" , David Howells , Arnd Bergmann , Dave Jones , "Rafael J. Wysocki" , Shaohua Li , Sasha Levin , KOSAKI Motohiro , Johannes Weiner , Ingo Molnar , "linux-doc@vger.kernel.org" , Linux-MM On Sun, Jul 14, 2013 at 7:11 AM, Oleg Nesterov wrote: > Sorry if this was already discussed... I am still trying to think if > we can make a simpler patch. > > So, iiuc, the main problem is that if you want to track a vma you need > to prevent the merging with other vma's. > > Question: is it important that vma's with the same vma_name should be > _merged_ automatically? > > If not, can't we make "do not merge" a separate feature and then add > vma_name? > > IOW, please forget about vma_name for the moment. Can't we start with > the trivial patch below? It simply adds the new vm flag which blocks > the merging, and MADV_ to set/clear it. > > Yes, this is more limited. Once you set VM_TAINTED this vma is always > isolated. If you unmap a page in this vma, you create 2 isolated vma's. > If, for example, you do MADV_DONTFORK + MADV_DOFORK inside the tainted > vma, you will have 2 adjacent VM_TAINTED vma's with the same flags after > that. But you can do MADV_UNTAINT + MADV_TAINT again if you want to > merge them back. And perhaps this feature is useful even without the > naming. And perhaps we can also add MAP_TAINTED. > > Now about vma_name. In this case PR_SET_VMA or MADV_NAME should simply > set/overwrite vma_name and nothing else, no need to do merge/split vma. > > And if we add MAP_TAINTED, MAP_ANONYMOUS can reuse pgoff as vma_name > (we only need a simple changes in do_mmap_pgoff and mmap_region). But > this is minor. > > Or this is too simple/ugly? Probably yes, this means that an allocator > which simply does a lot of MAP_ANONYMOUS + MADV_TAINT will create more > vma's than it needs. So I won't insist but I'd like to ask anyway. This is no different than using a new tmpfs file for every mmap (although it saves the struct file and the inode), it results in a huge increase in the number of vmas. -- 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