/* Allocate a memory block from the socket's option memory buffer.  */
void* sock_kmalloc(struct sock *sk, int size, gfp_t priority)
/* Allocate a memory block from the socket's option memory buffer.  */
void* sock_kmalloc(struct sock *sk, int size, gfp_t priority)
{
	if ((unsigned)size <= sysctl_optmem_max &&
	    atomic_read(&sk->sk_omem_alloc) + size < sysctl_optmem_max) {
		void *mem;
		atomic_add(size, &sk->sk_omem_alloc);
		mem = kmalloc(size, priority);
		if (mem)
			return mem;
		atomic_sub(size, &sk->sk_omem_alloc);
	}
	return NULL;
}