[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160516162039.GA19459@redhat.com>
Date: Mon, 16 May 2016 18:20:39 +0200
From: Oleg Nesterov <oleg@...hat.com>
To: Andrea Arcangeli <aarcange@...hat.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
linux-kernel@...r.kernel.org, linux-mm@...ck.org
Subject: Re: [PATCH 1/1] userfaultfd: don't pin the user memory in
userfaultfd_file_create()
On 05/16, Andrea Arcangeli wrote:
>
> Reviewed-by: Andrea Arcangeli <aarcange@...hat.com>
Thanks,
> > +static inline bool userfaultfd_get_mm(struct userfaultfd_ctx *ctx)
> > +{
> > + return atomic_inc_not_zero(&ctx->mm->mm_users);
> > +}
>
> Nice cleanup, but wouldn't it be more generic to implement this as
> mmget(&ctx->mm) (or maybe mmget_not_zero) in include/linux/mm.h
> instead of userfaultfd.c, so then others can use it too, see:
Yes, agreed. userfaultfd_get_mm() doesn't look as good as I initially thought.
So I guess it would be better to make V2 right now, to avoid another change in
userfaultfd.c which changes the same code.
Except I think mmget_not_zero() should go to linux/sched.h, until we move
mmdrop/mmput/etc to linux/mm.h.
I'll send V2 soon...
Oleg.
Powered by blists - more mailing lists