提交 c196403b 编写于 作者: G Gerald Schaefer 提交者: David S. Miller

net: rds: fix per-cpu helper usage

commit ae4b46e9 "net: rds: use this_cpu_* per-cpu helper" broke per-cpu
handling for rds. chpfirst is the result of __this_cpu_read(), so it is
an absolute pointer and not __percpu. Therefore, __this_cpu_write()
should not operate on chpfirst, but rather on cache->percpu->first, just
like __this_cpu_read() did before.

Cc: <stable@vger.kernel.org> # 3.8+
Signed-off-byd Gerald Schaefer <gerald.schaefer@de.ibm.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 8c12ec74
...@@ -421,8 +421,7 @@ static void rds_ib_recv_cache_put(struct list_head *new_item, ...@@ -421,8 +421,7 @@ static void rds_ib_recv_cache_put(struct list_head *new_item,
struct rds_ib_refill_cache *cache) struct rds_ib_refill_cache *cache)
{ {
unsigned long flags; unsigned long flags;
struct list_head *old; struct list_head *old, *chpfirst;
struct list_head __percpu *chpfirst;
local_irq_save(flags); local_irq_save(flags);
...@@ -432,7 +431,7 @@ static void rds_ib_recv_cache_put(struct list_head *new_item, ...@@ -432,7 +431,7 @@ static void rds_ib_recv_cache_put(struct list_head *new_item,
else /* put on front */ else /* put on front */
list_add_tail(new_item, chpfirst); list_add_tail(new_item, chpfirst);
__this_cpu_write(chpfirst, new_item); __this_cpu_write(cache->percpu->first, new_item);
__this_cpu_inc(cache->percpu->count); __this_cpu_inc(cache->percpu->count);
if (__this_cpu_read(cache->percpu->count) < RDS_IB_RECYCLE_BATCH_COUNT) if (__this_cpu_read(cache->percpu->count) < RDS_IB_RECYCLE_BATCH_COUNT)
...@@ -452,7 +451,7 @@ static void rds_ib_recv_cache_put(struct list_head *new_item, ...@@ -452,7 +451,7 @@ static void rds_ib_recv_cache_put(struct list_head *new_item,
} while (old); } while (old);
__this_cpu_write(chpfirst, NULL); __this_cpu_write(cache->percpu->first, NULL);
__this_cpu_write(cache->percpu->count, 0); __this_cpu_write(cache->percpu->count, 0);
end: end:
local_irq_restore(flags); local_irq_restore(flags);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册