linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@nvidia.com>
To: Ira Weiny <ira.weiny@intel.com>
Cc: Dennis Dalessandro <dennis.dalessandro@cornelisnetworks.com>,
	<dledford@redhat.com>, Jann Horn <jannh@google.com>,
	<linux-rdma@vger.kernel.org>,
	Mike Marciniszyn <mike.marciniszyn@cornelisnetworks.com>,
	<linux-mm@kvack.org>
Subject: Re: [PATCH for-rc v1] IB/hfi1: Move cached value of mm into handler
Date: Thu, 5 Nov 2020 11:17:23 -0400	[thread overview]
Message-ID: <20201105151723.GG2620339@nvidia.com> (raw)
In-Reply-To: <20201105001245.GG1531489@iweiny-DESK2.sc.intel.com>

On Wed, Nov 04, 2020 at 04:12:45PM -0800, Ira Weiny wrote:
> > -int hfi1_mmu_rb_register(void *ops_arg, struct mm_struct *mm,
> > +int hfi1_mmu_rb_register(void *ops_arg,
> >  			 struct mmu_rb_ops *ops,
> >  			 struct workqueue_struct *wq,
> >  			 struct mmu_rb_handler **handler)
> > @@ -110,18 +98,20 @@ int hfi1_mmu_rb_register(void *ops_arg, struct mm_struct *mm,
> >  	INIT_HLIST_NODE(&handlr->mn.hlist);
> >  	spin_lock_init(&handlr->lock);
> >  	handlr->mn.ops = &mn_opts;
> > -	handlr->mm = mm;
> >  	INIT_WORK(&handlr->del_work, handle_remove);
> >  	INIT_LIST_HEAD(&handlr->del_list);
> >  	INIT_LIST_HEAD(&handlr->lru_list);
> >  	handlr->wq = wq;
> >  
> > -	ret = mmu_notifier_register(&handlr->mn, handlr->mm);
> > +	ret = mmu_notifier_register(&handlr->mn, current->mm);
> >  	if (ret) {
> >  		kfree(handlr);
> >  		return ret;
> >  	}
> >  
> > +	mmget(current->mm);
> 
> I flagged this initially but then reviewed the commit message for why you need
> this reference.  I think it is worth a comment here as well as below.
> Specifically mentioning the order of calls in do_exit().

Oh? a mmget should not be held for a long time, and a notifier already
holds a mmgrab while it is registered

If hfi later needs the mmget then the only the part that needs it
should convert the mmgrab to a mmget with mmget_not_zero

Jason


  parent reply	other threads:[~2020-11-05 15:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-29  1:22 Dennis Dalessandro
2020-11-03  0:22 ` Jason Gunthorpe
2020-11-03 13:41   ` Dennis Dalessandro
     [not found] ` <20201105001245.GG1531489@iweiny-DESK2.sc.intel.com>
2020-11-05 15:17   ` Jason Gunthorpe [this message]
2020-11-05 17:13   ` Dennis Dalessandro
2020-11-10  4:36     ` Ira Weiny
2020-11-10 13:45       ` Dennis Dalessandro

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201105151723.GG2620339@nvidia.com \
    --to=jgg@nvidia.com \
    --cc=dennis.dalessandro@cornelisnetworks.com \
    --cc=dledford@redhat.com \
    --cc=ira.weiny@intel.com \
    --cc=jannh@google.com \
    --cc=linux-mm@kvack.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=mike.marciniszyn@cornelisnetworks.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox