Skip to content

Commit 5dc4f7f

Browse files
Mike Galbraithjnettlet
authored andcommitted
drivers/zram: fix zcomp_stream_get() smp_processor_id() use in preemptible code
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: [email protected] Signed-off-by: Mike Galbraith <[email protected]> Signed-off-by: Sebastian Andrzej Siewior <[email protected]> Signed-off-by: Steven Rostedt (VMware) <[email protected]>
1 parent 660e9af commit 5dc4f7f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/block/zram/zcomp.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ struct zcomp_strm *zcomp_stream_get(struct zcomp *comp)
120120
{
121121
struct zcomp_strm *zstrm;
122122

123-
zstrm = *this_cpu_ptr(comp->stream);
123+
zstrm = *get_local_ptr(comp->stream);
124124
spin_lock(&zstrm->zcomp_lock);
125125
return zstrm;
126126
}
@@ -131,6 +131,7 @@ void zcomp_stream_put(struct zcomp *comp)
131131

132132
zstrm = *this_cpu_ptr(comp->stream);
133133
spin_unlock(&zstrm->zcomp_lock);
134+
put_local_ptr(zstrm);
134135
}
135136

136137
int zcomp_compress(struct zcomp_strm *zstrm,

0 commit comments

Comments
 (0)