zsmalloc-replace-get_cpu_var-with-local_lock.patch removed from -mm tree
The patch titled
Subject: zsmalloc: replace get_cpu_var with local_lock
has been removed from the -mm tree. Its filename was
zsmalloc-replace-get_cpu_var-with-local_lock.patch
This patch was dropped because it was merged into mainline or a subsystem tree
------------------------------------------------------
From: Mike Galbraith <[email protected]>
Subject: zsmalloc: replace get_cpu_var with local_lock
The usage of get_cpu_var() in zs_map_object() is problematic because it disables preemption and makes it impossible to acquire any sleeping lock on PREEMPT_RT such as a spinlock_t.
Replace the get_cpu_var() usage with a local_lock_t which is embedded struct mapping_area. It ensures that the access the struct is synchronized against all users on the same CPU.
---
mm/zsmalloc.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
mm/zsmalloc.c renamed from mm/zsmalloc.c~zsmalloc-replace-get_cpu_var-with-local_lock +8 -3
@@ -65,6 +65,7 @@#include <linux/wait.h> #include <linux/pagemap.h> #include <linux/fs.h> +#include <linux/local_lock.h> #define ZSPAGE_MAGIC 0x58
@@ -276,6 +277,7 @@ struct zspage { };struct mapping_area { +local_lock_t lock;char *vm_buf;/* copy buffer for objects that span pages */ char *vm_addr;/* address of kmap_atomic()'ed pages */ enum zs_mapmode vm_mm;/* mapping mode */
@@ -451,7 +453,9 @@ MODULE_ALIAS("zpool-zsmalloc");#endif /* CONFIG_ZPOOL */ /* per-cpu VM mapping areas for zspage accesses that cross page boundaries */ -static DEFINE_PER_CPU(struct mapping_area, zs_map_area); +static DEFINE_PER_CPU(struct mapping_area, zs_map_area) = { + .lock =INIT_LOCAL_LOCK (lock), +};static __maybe_unused int is_first_page (struct page *page) {
@@ -1269,7 +1273,8 @@ void *zs_map_object(struct zs_pool *pool class =zspage_class (pool, zspage); off = (class->size * obj_idx) & ~PAGE_MASK ; - area = &get_cpu_var (zs_map_area); +local_lock (&zs_map_area.lock); + area =this_cpu_ptr (&zs_map_area); area->vm_mm = mm;if (off + class->size <=PAGE_SIZE ) {/* this object is contained entirely within a page */
@@ -1320,7 +1325,7 @@ void zs_unmap_object(struct zs_pool *poo__zs_unmap_object (area, pages, off, class->size); } -put_cpu_var (zs_map_area); +local_unlock (&zs_map_area.lock);migrate_read_unlock (zspage); }
_
Patches currently in -mm which might be from [email protected] are