mm/hmm: Hold a mmgrab from hmm to mm
authorJason Gunthorpe <jgg@mellanox.com>
Thu, 23 May 2019 13:36:46 +0000 (10:36 -0300)
committerJason Gunthorpe <jgg@mellanox.com>
Mon, 10 Jun 2019 13:10:33 +0000 (10:10 -0300)
commitc8a53b2db0aec40d8b217936e1b7f3d840c50390
treeea375fb462731dce8200eef3b650cd9acab2f1dd
parente36acfe6c86d13eec62321e1e86a1ce287e52e7d
mm/hmm: Hold a mmgrab from hmm to mm

So long as a struct hmm pointer exists, so should the struct mm it is
linked too. Hold the mmgrab() as soon as a hmm is created, and mmdrop() it
once the hmm refcount goes to zero.

Since mmdrop() (ie a 0 kref on struct mm) is now impossible with a !NULL
mm->hmm delete the hmm_hmm_destroy().

Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Reviewed-by: Jérôme Glisse <jglisse@redhat.com>
Reviewed-by: John Hubbard <jhubbard@nvidia.com>
Reviewed-by: Ralph Campbell <rcampbell@nvidia.com>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Tested-by: Philip Yang <Philip.Yang@amd.com>
include/linux/hmm.h
kernel/fork.c
mm/hmm.c