Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1313419 > unrolled thread

Re: [PATCH] mm, gup: introduce concept of "foreign" get_user_pages()

Started byVlastimil Babka <vbabka@suse.cz>
First post2016-01-20 19:00 +0100
Last post2016-01-20 19:50 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH] mm, gup: introduce concept of "foreign" get_user_pages() Vlastimil Babka <vbabka@suse.cz> - 2016-01-20 19:00 +0100
    Re: [PATCH] mm, gup: introduce concept of "foreign" get_user_pages() Dave Hansen <dave@sr71.net> - 2016-01-20 19:50 +0100

#1313419 — Re: [PATCH] mm, gup: introduce concept of "foreign" get_user_pages()

FromVlastimil Babka <vbabka@suse.cz>
Date2016-01-20 19:00 +0100
SubjectRe: [PATCH] mm, gup: introduce concept of "foreign" get_user_pages()
Message-ID<qT5d1-1vr-23@gated-at.bofh.it>
On 01/20/2016 06:35 PM, Dave Hansen wrote:
> Here's another revision taking Vlastimil's suggestions about
> keeping __get_user_pages_unlocked() as-is in to account.
> This does, indeed, look nicer.  Now, all the "__" variants
> take a full tsk/mm and flags.
> 
> He also noted that the two sites where we called gup with
> tsk=NULL were probably incorrectly changing behavior with respect
> to fault accounting.  Long-term, I wonder if we should just add
> a "FOLL_" flag to make that more explicit, but for now, I've
> fixed up those sites.
> 
> ---
> 
> From: Dave Hansen <dave.hansen@linux.intel.com>
> 
> For protection keys, we need to understand whether protections
> should be enforced in software or not.  In general, we enforce
> protections when working on our own task, but not when on others.
> We call these "current" and "foreign" operations.
> 
> This patch introduces a new get_user_pages() variant:
> 
> 	get_user_pages_foreign()
> 
> The plain get_user_pages() can no longer be used on mm/tasks
> other than 'current/current->mm', which is by far the most common
> way it is called.  Using it makes a few of the call sites look a
> bit nicer.
> 
> In other words, get_user_pages_foreign() is a replacement for
> when get_user_pages() is called on non-current tsk/mm.
> 
> This also switches get_user_pages_(un)locked() over to be like
> get_user_pages() and not take a tsk/mm.  There is no
> get_user_pages_foreign_(un)locked().  If someone wants that
> behavior they just have to use "__" variant and pass in
> FOLL_FOREIGN explicitly.

Hm so this gets a bit ahead of patch "mm: add gup flag to indicate "foreign" mm
access", right? It might be cleaner to postpone passing FOLL_FOREIGN until then,
but not critical.

BTW doesn't that other patch miss passing FOLL_FOREIGN from
get_user_pages_foreign() or something? I see it only uses it from break_ksm(),
am I missing something?

[toc] | [next] | [standalone]


#1313442

FromDave Hansen <dave@sr71.net>
Date2016-01-20 19:50 +0100
Message-ID<qT5Zo-24v-27@gated-at.bofh.it>
In reply to#1313419
On 01/20/2016 09:56 AM, Vlastimil Babka wrote:
> On 01/20/2016 06:35 PM, Dave Hansen wrote:
>> This also switches get_user_pages_(un)locked() over to be like
>> get_user_pages() and not take a tsk/mm.  There is no
>> get_user_pages_foreign_(un)locked().  If someone wants that
>> behavior they just have to use "__" variant and pass in
>> FOLL_FOREIGN explicitly.
> 
> Hm so this gets a bit ahead of patch "mm: add gup flag to indicate "foreign" mm
> access", right? It might be cleaner to postpone passing FOLL_FOREIGN until then,
> but not critical.

I've reworded that patch a bit, so it just talks about only enforcing
pkey permissions on non-foreign accesses.  I think I'll keep
FOLL_FOREIGN in this patch because it fits in well with the other things
converted to get_user_pages_foreign().

> BTW doesn't that other patch miss passing FOLL_FOREIGN from
> get_user_pages_foreign() or something? I see it only uses it from break_ksm(),
> am I missing something?

Nope.  At some point along the way, it got dropped in a merge.  Thanks
for catching that!  I'll include it in future versions of this patch.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web