From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from psmtp.com (na3sys010amx197.postini.com [74.125.245.197]) by kanga.kvack.org (Postfix) with SMTP id 48E366B0032 for ; Wed, 10 Jul 2013 20:19:20 -0400 (EDT) Message-ID: <51DDFA02.9040707@intel.com> Date: Wed, 10 Jul 2013 17:19:14 -0700 From: Dave Hansen MIME-Version: 1.0 Subject: Re: [PATCH] mm: add sys_madvise2 and MADV_NAME to name vmas References: <1372901537-31033-1-git-send-email-ccross@android.com> <51DDE974.6060200@intel.com> <51DDF071.5000309@intel.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Sender: owner-linux-mm@kvack.org List-ID: To: Colin Cross Cc: lkml , Kyungmin Park , Christoph Hellwig , John Stultz , Rob Landley , Arnd Bergmann , 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 , Rusty Russell , "Eric W. Biederman" , Oleg Nesterov , Srikar Dronamraju , KAMEZAWA Hiroyuki , Michal Hocko , Anton Vorontsov , Pekka Enberg , Shaohua Li , Sasha Levin , KOSAKI Motohiro , Johannes Weiner , Ingo Molnar , open@kvack.org, list@kvack.org, DOCUMENTATION open@kvack.orglist@kvack.org, MEMORY MANAGEMENT , "open list:GENERIC INCLUDE/A..." On 07/10/2013 05:12 PM, Colin Cross wrote: > I wonder if it > would be worth trying to make names a struct file? They would be > significantly larger than a struct vma_name, but reuse all the > existing refcounting code. Not worth it INMHO. >> Here's one more idea: instead of having a kernel pointer, let's let >> userspace hand the kernel a userspace address, and the kernel will hang >> on to it. Userspace is responsible for keeping it valid, kind of like >> ARGV[]. When the kernel goes to dump out the /proc/$pid/maps fields, it >> can do a copy_from_user() to get the string back out. If this fails, it >> can just go and treat it like a non-named VMA, or could output >> "userspace sucks". >> >> That way, the kernel isn't dealing with refcounting and allocating >> strings. It's got security concerns, just like >> /proc/$pid/cmdline since it'll let you dig around in another process's >> address space via /proc. But, I think they're manageable. > > How do you deal with merging adjacent vmas with the same name? The > whole point of the refcounted strings is to allow comparing strings > for equality by comparing pointers. You could say that a named vma > never gets merged, but then you might as well use separate tmpfs > files, and you end up at least doubling the number of vmas in some > processes I've seen. If they have the same userspace pointer target, then they get merged. Two adjacent vmas with the same name (according to strcmp()) would not get merged. -- 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