Skip to content

Commit

Permalink
mm/hmm: Remove racy protection against double-unregistration
Browse files Browse the repository at this point in the history
No other register/unregister kernel API attempts to provide this kind of
protection as it is inherently racy, so just drop it.

Callers should provide their own protection, and it appears nouveau
already does.

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: Christoph Hellwig <hch@lst.de>
Tested-by: Philip Yang <Philip.Yang@amd.com>
  • Loading branch information
Jason Gunthorpe committed Jun 24, 2019
1 parent 8a1a0cd commit 187229c
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions mm/hmm.c
Original file line number Diff line number Diff line change
Expand Up @@ -276,17 +276,11 @@ EXPORT_SYMBOL(hmm_mirror_register);
*/
void hmm_mirror_unregister(struct hmm_mirror *mirror)
{
struct hmm *hmm = READ_ONCE(mirror->hmm);

if (hmm == NULL)
return;
struct hmm *hmm = mirror->hmm;

down_write(&hmm->mirrors_sem);
list_del_init(&mirror->list);
/* To protect us against double unregister ... */
mirror->hmm = NULL;
up_write(&hmm->mirrors_sem);

hmm_put(hmm);
}
EXPORT_SYMBOL(hmm_mirror_unregister);
Expand Down

0 comments on commit 187229c

Please sign in to comment.