2018-08-27 14:32:32 +00:00
|
|
|
From: Mike Galbraith <efault@gmx.de>
|
|
|
|
Date: Wed, 23 Aug 2017 11:57:29 +0200
|
2019-11-25 00:04:39 +00:00
|
|
|
Subject: [PATCH 250/290] drivers/zram: fix zcomp_stream_get()
|
2019-04-08 23:49:20 +00:00
|
|
|
smp_processor_id() use in preemptible code
|
2019-11-25 00:04:39 +00:00
|
|
|
Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=59f018ada02ffa0ce88d91aa36f5482f9c64054b
|
2018-08-27 14:32:32 +00:00
|
|
|
|
|
|
|
Use get_local_ptr() instead this_cpu_ptr() to avoid a warning regarding
|
|
|
|
smp_processor_id() in preemptible code.
|
|
|
|
raw_cpu_ptr() would be fine, too because the per-CPU data structure is
|
|
|
|
protected with a spin lock so it does not matter much if we take the
|
|
|
|
other one.
|
|
|
|
|
|
|
|
Cc: stable-rt@vger.kernel.org
|
|
|
|
Signed-off-by: Mike Galbraith <efault@gmx.de>
|
|
|
|
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
|
|
|
|
---
|
2019-04-08 23:49:20 +00:00
|
|
|
drivers/block/zram/zcomp.c | 3 ++-
|
2018-08-27 14:32:32 +00:00
|
|
|
1 file changed, 2 insertions(+), 1 deletion(-)
|
|
|
|
|
2019-04-08 23:49:20 +00:00
|
|
|
diff --git a/drivers/block/zram/zcomp.c b/drivers/block/zram/zcomp.c
|
|
|
|
index dd65a27ae2cc..eece02262000 100644
|
2018-08-27 14:32:32 +00:00
|
|
|
--- a/drivers/block/zram/zcomp.c
|
|
|
|
+++ b/drivers/block/zram/zcomp.c
|
2019-04-08 23:49:20 +00:00
|
|
|
@@ -118,7 +118,7 @@ struct zcomp_strm *zcomp_stream_get(struct zcomp *comp)
|
2018-08-27 14:32:32 +00:00
|
|
|
{
|
|
|
|
struct zcomp_strm *zstrm;
|
|
|
|
|
|
|
|
- zstrm = *this_cpu_ptr(comp->stream);
|
|
|
|
+ zstrm = *get_local_ptr(comp->stream);
|
|
|
|
spin_lock(&zstrm->zcomp_lock);
|
|
|
|
return zstrm;
|
|
|
|
}
|
2019-04-08 23:49:20 +00:00
|
|
|
@@ -129,6 +129,7 @@ void zcomp_stream_put(struct zcomp *comp)
|
2018-08-27 14:32:32 +00:00
|
|
|
|
|
|
|
zstrm = *this_cpu_ptr(comp->stream);
|
|
|
|
spin_unlock(&zstrm->zcomp_lock);
|
|
|
|
+ put_local_ptr(zstrm);
|
|
|
|
}
|
|
|
|
|
|
|
|
int zcomp_compress(struct zcomp_strm *zstrm,
|