Re: [PATCH] Code clean up for percpu_xxx() functions

From: Eric Dumazet
Date: Thu Oct 20 2011 - 01:08:27 EST


Le jeudi 20 octobre 2011 Ã 10:44 +0800, Alex,Shi a Ãcrit :
> > Acked-by: Christoph Lameter <cl@xxxxxxxxxx>
>
> Thanks, Christoph!
> and resend for code style problem correction.
>

Sorry this huge patch brings too many potential bugs.

I ask you a separate patch for the networking part, because I dont want
to Ack all the other parts.

> diff --git a/net/socket.c b/net/socket.c
> index ffe92ca..2845d38 100644
> --- a/net/socket.c
> +++ b/net/socket.c
> @@ -479,7 +479,7 @@ static struct socket *sock_alloc(void)
> inode->i_uid = current_fsuid();
> inode->i_gid = current_fsgid();
>
> - percpu_add(sockets_in_use, 1);
> + __this_cpu_add(sockets_in_use, 1);

No, we are in process context, you need

this_cpu_add(sockets_in_use, 1);

> return sock;
> }
>
> @@ -522,7 +522,7 @@ void sock_release(struct socket *sock)
> if (rcu_dereference_protected(sock->wq, 1)->fasync_list)
> printk(KERN_ERR "sock_release: fasync list not empty!\n");
>
> - percpu_sub(sockets_in_use, 1);
> + __this_cpu_sub(sockets_in_use, 1);

this_cpu_sub();

> if (!sock->file) {
> iput(SOCK_INODE(sock));
> return;



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/