From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754265AbcEPQVH (ORCPT ); Mon, 16 May 2016 12:21:07 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40095 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753654AbcEPQVE (ORCPT ); Mon, 16 May 2016 12:21:04 -0400 Date: Mon, 16 May 2016 18:20:39 +0200 From: Oleg Nesterov To: Andrea Arcangeli Cc: Andrew Morton , Linus Torvalds , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH 1/1] userfaultfd: don't pin the user memory in userfaultfd_file_create() Message-ID: <20160516162039.GA19459@redhat.com> References: <20160516152522.GA19120@redhat.com> <20160516152546.GA19129@redhat.com> <20160516155729.GH550@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160516155729.GH550@redhat.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Mon, 16 May 2016 16:20:41 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/16, Andrea Arcangeli wrote: > > Reviewed-by: Andrea Arcangeli 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.