Skip to content

Commit

Permalink
net: rds: fix per-cpu helper usage
Browse files Browse the repository at this point in the history
commit ae4b46e "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: <[email protected]> # 3.8+
Signed-off-byd Gerald Schaefer <[email protected]>

Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
gerald-schaefer authored and davem330 committed Jan 18, 2014
1 parent 8c12ec7 commit c196403
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions net/rds/ib_recv.c
Original file line number Diff line number Diff line change
Expand Up @@ -421,8 +421,7 @@ static void rds_ib_recv_cache_put(struct list_head *new_item,
struct rds_ib_refill_cache *cache)
{
unsigned long flags;
struct list_head *old;
struct list_head __percpu *chpfirst;
struct list_head *old, *chpfirst;

local_irq_save(flags);

Expand All @@ -432,7 +431,7 @@ static void rds_ib_recv_cache_put(struct list_head *new_item,
else /* put on front */
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);

if (__this_cpu_read(cache->percpu->count) < RDS_IB_RECYCLE_BATCH_COUNT)
Expand All @@ -452,7 +451,7 @@ static void rds_ib_recv_cache_put(struct list_head *new_item,
} while (old);


__this_cpu_write(chpfirst, NULL);
__this_cpu_write(cache->percpu->first, NULL);
__this_cpu_write(cache->percpu->count, 0);
end:
local_irq_restore(flags);
Expand Down

0 comments on commit c196403

Please sign in to comment.