Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F177948463
D61990.1795625690.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
D61990.1795625690.diff
View Options
diff --git a/sys/compat/linuxkpi/common/include/linux/mm_types.h b/sys/compat/linuxkpi/common/include/linux/mm_types.h
--- a/sys/compat/linuxkpi/common/include/linux/mm_types.h
+++ b/sys/compat/linuxkpi/common/include/linux/mm_types.h
@@ -57,6 +57,12 @@
linux_mm_dtor(mm);
}
+static inline void
+mmget(struct mm_struct *mm)
+{
+ atomic_inc(&mm->mm_users);
+}
+
static inline bool
mmget_not_zero(struct mm_struct *mm)
{
@@ -70,6 +76,17 @@
mmdrop(mm);
}
+/*
+ * Linux defers the final teardown of the address space to a workqueue
+ * because it may sleep. Dropping the last mm_users reference here only
+ * frees the mm_struct and never sleeps, so this is mmput().
+ */
+static inline void
+mmput_async(struct mm_struct *mm)
+{
+ mmput(mm);
+}
+
static inline void
mmgrab(struct mm_struct *mm)
{
diff --git a/sys/compat/linuxkpi/common/include/linux/mmap_lock.h b/sys/compat/linuxkpi/common/include/linux/mmap_lock.h
--- a/sys/compat/linuxkpi/common/include/linux/mmap_lock.h
+++ b/sys/compat/linuxkpi/common/include/linux/mmap_lock.h
@@ -44,6 +44,13 @@
up_read(&mm->mmap_sem);
}
+static inline void
+mmap_write_lock(struct mm_struct *mm)
+{
+
+ down_write(&mm->mmap_sem);
+}
+
static inline void
mmap_write_lock_killable(struct mm_struct *mm)
{
@@ -51,4 +58,18 @@
down_write_killable(&mm->mmap_sem);
}
+static inline void
+mmap_write_unlock(struct mm_struct *mm)
+{
+
+ up_write(&mm->mmap_sem);
+}
+
+static inline void
+mmap_write_downgrade(struct mm_struct *mm)
+{
+
+ downgrade_write(&mm->mmap_sem);
+}
+
#endif /* _LINUXKPI_LINUX_MMAP_LOCK_H_ */
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Nov 25, 4:54 PM (23 h, 7 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41992517
Default Alt Text
D61990.1795625690.diff (1 KB)
Attached To
Mode
D61990: LinuxKPI: Add mmap write lock helpers, mmget() and mmput_async()
Attached
Detach File
Event Timeline