#include <linux/spinlock.h>
 #include <linux/mutex.h>
 #include <linux/freezer.h>
+#include <linux/sched/mm.h>
 
 #include <linux/sunrpc/clnt.h>
 
 
 static void rpc_async_schedule(struct work_struct *work)
 {
+       unsigned int pflags = memalloc_nofs_save();
+
        __rpc_execute(container_of(work, struct rpc_task, u.tk_work));
+       memalloc_nofs_restore(pflags);
 }
 
 /**
 
 static void rpc_async_release(struct work_struct *work)
 {
+       unsigned int pflags = memalloc_nofs_save();
+
        rpc_free_task(container_of(work, struct rpc_task, u.tk_work));
+       memalloc_nofs_restore(pflags);
 }
 
 static void rpc_release_resources_task(struct rpc_task *task)
 
 #include <linux/sunrpc/metrics.h>
 #include <linux/sunrpc/bc_xprt.h>
 #include <linux/rcupdate.h>
+#include <linux/sched/mm.h>
 
 #include <trace/events/sunrpc.h>
 
 {
        struct rpc_xprt *xprt =
                container_of(work, struct rpc_xprt, task_cleanup);
+       unsigned int pflags = memalloc_nofs_save();
 
        clear_bit(XPRT_CLOSE_WAIT, &xprt->state);
        xprt->ops->close(xprt);
        xprt_release_write(xprt, NULL);
        wake_up_bit(&xprt->state, XPRT_LOCKED);
+       memalloc_nofs_restore(pflags);
 }
 
 /**
 
 #include <linux/bvec.h>
 #include <linux/highmem.h>
 #include <linux/uio.h>
+#include <linux/sched/mm.h>
 
 #include <trace/events/sunrpc.h>
 
 {
        struct sock_xprt *transport =
                container_of(work, struct sock_xprt, recv_worker);
+       unsigned int pflags = memalloc_nofs_save();
+
        xs_stream_data_receive(transport);
+       memalloc_nofs_restore(pflags);
 }
 
 static void
 {
        struct sock_xprt *transport =
                container_of(work, struct sock_xprt, recv_worker);
+       unsigned int pflags = memalloc_nofs_save();
+
        xs_udp_data_receive(transport);
+       memalloc_nofs_restore(pflags);
 }
 
 /**
                sk->sk_write_space = xs_udp_write_space;
                sock_set_flag(sk, SOCK_FASYNC);
                sk->sk_error_report = xs_error_report;
-               sk->sk_allocation = GFP_NOIO;
 
                xprt_clear_connected(xprt);
 
                sk->sk_data_ready = xs_data_ready;
                sk->sk_write_space = xs_udp_write_space;
                sock_set_flag(sk, SOCK_FASYNC);
-               sk->sk_allocation = GFP_NOIO;
 
                xprt_set_connected(xprt);
 
                sk->sk_write_space = xs_tcp_write_space;
                sock_set_flag(sk, SOCK_FASYNC);
                sk->sk_error_report = xs_error_report;
-               sk->sk_allocation = GFP_NOIO;
 
                /* socket options */
                sock_reset_flag(sk, SOCK_LINGER);