Skip to content

Commit

Permalink
taskstats: Use this_cpu_ops
Browse files Browse the repository at this point in the history
Use this_cpu_inc_return in one place and avoid ugly __raw_get_cpu in
another.

V3->V4:
	- Fix off by one.

V4-V4f:
	- Use &listener_array

Cc: Michael Holzheu <holzheu@linux.vnet.ibm.com>
Acked-by: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Christoph Lameter <cl@linux.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
  • Loading branch information
Christoph Lameter authored and Tejun Heo committed Dec 17, 2010
1 parent b29c617 commit cd85fc5
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions kernel/taskstats.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,7 @@ static int prepare_reply(struct genl_info *info, u8 cmd, struct sk_buff **skbp,
return -ENOMEM;

if (!info) {
int seq = get_cpu_var(taskstats_seqnum)++;
put_cpu_var(taskstats_seqnum);
int seq = this_cpu_inc_return(taskstats_seqnum) - 1;

reply = genlmsg_put(skb, 0, seq, &family, 0, cmd);
} else
Expand Down Expand Up @@ -581,7 +580,7 @@ void taskstats_exit(struct task_struct *tsk, int group_dead)
fill_tgid_exit(tsk);
}

listeners = &__raw_get_cpu_var(listener_array);
listeners = __this_cpu_ptr(&listener_array);
if (list_empty(&listeners->list))
return;

Expand Down

0 comments on commit cd85fc5

Please sign in to comment.