diff options
author | Jason Gunthorpe <jgg@mellanox.com> | 2019-11-12 16:22:18 -0400 |
---|---|---|
committer | Jason Gunthorpe <jgg@mellanox.com> | 2019-11-12 20:18:27 -0400 |
commit | 56f434f40f059eb3769d50b9c244a850096c3d6f (patch) | |
tree | e8c65d9bae28ef8767f528bd07bbfcf0f3e0f002 /mm/mmu_notifier.c | |
parent | 0e64e5b38c0106c054bc9b6acc5d0e605ac6ad47 (diff) |
mm/mmu_notifier: define the header pre-processor parts even if disabled
Now that we have KERNEL_HEADER_TEST all headers are generally compile
tested, so relying on makefile tricks to avoid compiling code that depends
on CONFIG_MMU_NOTIFIER is more annoying.
Instead follow the usual pattern and provide most of the header with only
the functions stubbed out when CONFIG_MMU_NOTIFIER is disabled. This
ensures code compiles no matter what the config setting is.
While here, struct mmu_notifier_mm is private to mmu_notifier.c, move it.
Link: https://lore.kernel.org/r/20191112202231.3856-2-jgg@ziepe.ca
Reviewed-by: Jérôme Glisse <jglisse@redhat.com>
Tested-by: Ralph Campbell <rcampbell@nvidia.com>
Reviewed-by: John Hubbard <jhubbard@nvidia.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Diffstat (limited to 'mm/mmu_notifier.c')
-rw-r--r-- | mm/mmu_notifier.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/mm/mmu_notifier.c b/mm/mmu_notifier.c index 7fde88695f35..367670cfd02b 100644 --- a/mm/mmu_notifier.c +++ b/mm/mmu_notifier.c @@ -28,6 +28,19 @@ struct lockdep_map __mmu_notifier_invalidate_range_start_map = { #endif /* + * The mmu notifier_mm structure is allocated and installed in + * mm->mmu_notifier_mm inside the mm_take_all_locks() protected + * critical section and it's released only when mm_count reaches zero + * in mmdrop(). + */ +struct mmu_notifier_mm { + /* all mmu notifiers registered in this mm are queued in this list */ + struct hlist_head list; + /* to serialize the list modifications and hlist_unhashed */ + spinlock_t lock; +}; + +/* * This function can't run concurrently against mmu_notifier_register * because mm->mm_users > 0 during mmu_notifier_register and exit_mmap * runs with mm_users == 0. Other tasks may still invoke mmu notifiers |