/* In order to avoid memory starvation triggering more writebacks of NFS requests, we avoid using GFP_KERNEL.  */
void* rpc_malloc(struct rpc_task *task, size_t size)
/* In order to avoid memory starvation triggering more writebacks of NFS requests, we avoid using GFP_KERNEL.  */
void* rpc_malloc(struct rpc_task *task, size_t size)
{
	struct rpc_buffer *buf;
	gfp_t gfp = RPC_IS_SWAPPER(task) ? GFP_ATOMIC : GFP_NOWAIT;
	size += sizeof(struct rpc_buffer);
	if (size <= RPC_BUFFER_MAXSIZE)
		buf = mempool_alloc(rpc_buffer_mempool, gfp);
	else
		buf = kmalloc(size, gfp);
	if (!buf)
		return NULL;
	buf->len = size;
	dprintk("RPC: %5u allocated buffer of size %zu at %p\n",
			task->tk_pid, size, buf);
	return &buf->data;
}