Re: [mm][RFC][PATCH 0/11] mm accessor updates.

Christoph Lameter
2009-12-17T20:15:01Z

On Thu, 17 Dec 2009, Peter Zijlstra wrote:

> > You always need some reference on the mm_struct (mm_read_lock) if you are
> > going to sleep to ensure that mm_struct still exists after waking up (page
> > fault, page allocation). RCU and other spin locks are not helping there.
>
> Depends what you go to sleep for, the page fault retry patches simply
> retook the whole fault and there is no way the mm could have gone away
> when userspace isn't executing.

get_user_pages ?

> Also pinning a page will pin the vma will pin the mm, and then you can
> always take explicit mm_struct refs, but you really want to avoid that
> since that's a global cacheline again.

Incrementing a refcount on some random page wont protect you unless
mmap_sem is held.